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 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

great that was really what I needed. thanks again. I accepted your answer.
0

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

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.