Is it possible to add the [Serializable] attribute to Entity Developer Types ?

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
EdB
Posts: 92
Joined: Mon 15 Oct 2012 09:24

Is it possible to add the [Serializable] attribute to Entity Developer Types ?

Post by EdB » Tue 06 Nov 2018 09:46

I need to add [Serializable] to certain types to use "out of process" session persistence. Presently I have to edit the generated code which is incorrect since it will get overwritten on the next POCO generation. In addition we only put the EDML into source control as we consider this to be the source and not the generated C# POCOs.

Is there a way to add [Serializable] in the relevant types in Entity Developer such that [Serializable] is included in the generated C# Class Definition code?

I have looked at the "Attributes" dialog, but this seems focussed on "Data Annotations".

Thanks.

Shalex
Site Admin
Posts: 8375
Joined: Thu 14 Aug 2008 12:44

Re: Is it possible to add the [Serializable] attribute to Entity Developer Types ?

Post by Shalex » Tue 06 Nov 2018 18:41

1. Please specify the names of templates (e.g.: POCO Entity, DbContext, etc) you are using in your *.edml model. We will investigate the possibility of implementing the Generate Serializable Attribute property of a template.

2. You can set any custom attribute in your classes/class properties:
a) navigate to Model > Settings > Attributes > select the assembly with the needed attributes and make sure that the required attributes are checked in the window below, press OK
b) select the needed attribute in the Attributes collection of a particular class / class property

Post Reply