Search code examples
c#asp.net-mvc-5ado.net-entity-data-model

Updating ado.net entity data model without effecting model classes already in EDMX


i have done lot of attribute validation on Models in EDMX entity data model class .but the time of Updating by adding a new table the ado.net entity data model automatically removed all attributes which i given.

Is there any way to update newly added table model class without effecting other models which i Customized..


Solution

  • The bad point is you have worked on auto-generated code.

    But you are lucky, if you observe with more attention your model classes you should see that they are partial classes so you can extend the classes in another files and put their attribute respectively on each one and you won't be affected be any generation of your EDMX.

    Try this and give us the result ;-)