1

I am using entity framework db first. how do I add data annotations to the model without putting it into the auto generated model?

I want to avoid losing the work I have done, in case I need to add a new column to the table.

Any small explanation or link would be helpful for me to understand.

thanks,

Andy

2 Answers2

1

You can use a second partial class that is created by you which includes the data annotations you like.

Look here for an answer covering this issue.

Community
  • 1
  • 1
Mert Akcakaya
  • 3,109
  • 2
  • 31
  • 42
0

I think Code first migrations is what you are looking for.

Cybercop
  • 8,475
  • 21
  • 75
  • 135
  • thank you Biplov13. i may change to code first later on. I am testing database first currently. think code first makes more sense as you can do much more and get more control. I am trying to understand the benefits of db first.thanks :) – Andreas Peiris Feb 24 '14 at 21:34