sql server - Entity Framework: Column must be mapped although it does have a default value? -


I am trying to create an entity framework 4 model based on a legacy SQL Server 2008 database. Since the model is going to be published in a web service, I have to leave an integer column called the Newsletter, which subscribes to the institutions of a model.

After removing the column in EF Designer, I found the following compilation error: Error 59 Error 3023: Problem in mapping pieces starting with line 356: Column user. Users should be mapped to subscribe to the newsletter table: It does not have any default values ​​and it is not faucetable. C: \ Users \ Adrian \ Documents \ Sites \ Zeiterfassung \ Zeiterfassung \ API \ V1 \ EFModel.edmx 357 15 Zeiterfassung

But the column has a default value of 0 which is limited to it. I tried to run this SQL statement against the database:

  Alternate table [dbo]. Add default ((0)) to [user] [Received from Newsletter subscription]  

but also fails:

Message 1781, level 16, State 1, already has a default default in line 3 column. Message 1750, Level 16, State 0, Line 3 could not be constrained. See previous errors.

So there is no default value in the column (in that case I'm not sure why I can not create it), or the unit framework does not see it. What is happening?

Thanks,

Adrian

with an Entity Designer Open the .amcc with Visual Studio XML Editor, and add a DefaultValue = "0" attribute to the unmodified column in the SSDL. These are not generated from the database for some reasons.


Comments