Is is possible to add an "unmapped" property to an entity (i.e. a property which has no data-storage column specified). If I try this by adding a new property and specify "none" for Storage Column, then the Entity Developer creates a compiler error "Problem in mapping fragments ... No mapping specified for ... An Entity with Key(PK) will not round-trip when: Entity is type [...]
I would like to add some extended properties to some entities for application use, that would be ignored for data-storage operations... but wanted to avoid wrapping each entity class in another class just for that purpose. I know, maybe it's bad design practice... but I was hoping this could be done with the EF designer and code generation.
Thanks
Entity with Unmapped Property?
Re: Entity with Unmapped Property?
Yes, it is possible. You are working in Entity Developer, aren't you? Set the Generate Partial Class property of the template to True and create an unmapped property manually in the code.cstahlsmith wrote:Is is possible to add an "unmapped" property to an entity (i.e. a property which has no data-storage column specified).
If Generate Partial Class is set to True, then, for each class in the model, a partial class (%ModelName%.%ClassName%.cs) will be generated, in which the user can add code that is not overwritten be the designer. If %ModelName%.%ClassName%.cs was created before, it would be left unchanged (so you may need to remove it to regenerate the code with the new setting). The property can be used, if File Per Class is turned on.