Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF4 CTP5 - Audit columns CreatedOn

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

like image 911
DotnetShadow Avatar asked Jan 31 '26 19:01

DotnetShadow


1 Answers

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

like image 92
Ladislav Mrnka Avatar answered Feb 03 '26 00:02

Ladislav Mrnka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!