Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

How to handle rowguid for replication in EF

$
0
0

I'm having some trouble trying to [INSERT/UPDATE] records in our database since we have implemented a replication scenario. (SQL SERVER 2012)

When I try to save an entity I get these messages:

Updating columns with the rowguidcol property is not allowed.

The transaction ended in the trigger. The batch has been aborted.

Sometimes this one

Cannot insert duplicate key row in object 'dbo.Job' with unique index 'MSmerge_index_1345596032'. The duplicate key value is (00000000-0000-0000-0000-000000000000).

I'm a bit lost as to how to generate the edmx model, without it having the rowguid being in the Entities.

The pattern I use to save

        var entry = db.Entry(job);

        entry.State = (job.JobId == 0) ? EntityState.Added : EntityState.Modified;
        db.SaveChanges();

        return entry.Entity.JobId;

How do I use Ef and replication without going crazy with the rowguid?

UPDATE:

I have set in the modal browser the rowguid property of StoreGeneratedPattern to Identity, it seems to working again, but I don't know the impact of doing it that way.

What is the best way to deal with Replication with EF??


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>