Friday 15 February 2013

c# - Prevent EF data migrations from dropping column -



c# - Prevent EF data migrations from dropping column -

i have sql server table column datecreated defaulting getdate().

create table [dbo].[group]( [groupid] [int] identity(1,1) not null, [groupname] [nvarchar](128) not null, [datecreated] [datetime] not null ) on [primary]

the datecreated field not used in crud application, although required other applications reporting. have entity framework class mapped table, leave datecreated property off entity class noise within application. value auto generated in database on insert anyway.

my problem whenever generate info migrations, column dropped table because not represented in entity model.

is there way exclude database columns ef info migrations?

could seek setting datecreated property internal/private, it's not exposed rest of code? i've done linq-2-sql orm in past, because didn't need fields exposed code/work (similar situation, few fields used info exports system, unneeded code).

c# sql-server entity-framework code-first-migrations

No comments:

Post a Comment