Just beeen using EF4 CTP code first and was wondering how to enable audit fields such as CreatedOn (datetime) will this get populated when I save an item or do I have to do some mapping?
Thanks in advance
DotnetShadow
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to populate them in your code or if you want EF to generate DB for you, you need a mapping (at least present them in your POCO class). If you have existing database and this column will never be presented in your application you don’t need mapping. Instead you can set default value of that column (in MS SQL you will use GetDate() as default value).