DotnetShadow
DotnetShadow

Reputation: 778

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

Upvotes: 3

Views: 274

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364319

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

Upvotes: 1

Related Questions