EF 5.0 Model First - How to Create Non-Displayable Properties

The First code has a [NotMapped] attribute for properties that should not be displayed: how to achieve the same in the first model mode?

+3


source to share


1 answer


NotMapped

properties are not part of your mapping. When the first approach to the model is used, the EDMX is a mapping, so every property that is defined in the diagram is displayed. If you want to have a property that is not displayed, it should not be defined in the chart. All classes generated by EF code generators are partial, so you only need to create your own partial class part (it must be in the same namespace and assembly as the generated part) and define your non-mapped property in the code.



+5


source







All Articles