SQL Server Replication and Entity Framework

When setup database merge replication, rowguid columns are added to every table automatically, identity cannot be used as primary key in this replication.
This rowguid column has default value, so your app doesn’t need to be updated … but, in EF you can update model from database schema, then all these rowguid columns are imported … and EF will raise error build. 😦

Column MyTable.rowguid in table MyTable must be mapped: It has no default value and is not nullable.

The quick&dirty solution is: edit .edmx file, and delete all rowguid columns, and everything related.

A better solution is to write an EF add-in extension, in order to filter away rowguid columns …
unfortunately, I can’t provide any link because can’t remember where I read that tip 😦
here is a post: Error 3032 during EF 4.0 validation  ,  last reply by JendaPearl
hope it helps! 😉

Technorati tags: SQL Server, Entity Framework

Tags: ,

One Response to “SQL Server Replication and Entity Framework”

  1. Broly Says:

    Good insight, thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: