0

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..

MMM
  • 3,132
  • 3
  • 20
  • 32
  • You can create a ViewModel Class that holds the same properties as your complex types, add your data annotations and then map them to your actual complex types. – shammelburg Jun 01 '15 at 09:47
  • 1
    See http://stackoverflow.com/questions/3782405/can-i-define-properties-in-partial-classes-then-mark-them-with-attributes-in-an – sallushan Jun 01 '15 at 11:21

1 Answers1

1

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 ;-)

D4rkTiger
  • 352
  • 1
  • 13