Entity Framework and SQL Server 2008 R2 Replication

I am building a Application(C#) with a SQL Database to store my Data. This data is replicated to a Data Warehouse using SQL Merge Replication.I designed the database first, and setup the replication, and tested the replication using standard t-sql scripts in SSMS.

I then build the Application and decided to use the Entity Framework with the Database-First capability;

When I do an Insert, I recieve the following error: Column MyTable.rowguid in table MyTable must be mapped: It has no default value and is not nullable;

After spending some time on google I found a simple solution here.

Solution:

Open the Model, select the Entity Property, in my case “rowguid”

Model after Updated from Database

In the Properties, select the StoreGeneratedPattern and change it from None to Identity

Model after rowguid's StoreGeneratedPattern has been changed

 

 

Leave a comment