Table-per-type inheritance insert problem
Posted
by
gzak
on Stack Overflow
See other posts from Stack Overflow
or by gzak
Published on 2011-01-30T02:27:28Z
Indexed on
2011/01/30
15:25 UTC
Read the original article
Hit count: 252
I followed this article on making a table-per-type inheritance model for my entities, but I get the following error when I try to add an instance of a subclass to the database.
Here is how I create the subtype:
var cust = db.Users.CreateObject<Customer>(); // Customer inherits User
db.Users.AddObject(cust);
db.SaveChanges();
I get the following error when I make that last call:
"A value shared across entities or associations is generated in more than one location. Check that mapping does not split an EntityKey to multiple store-generated columns."
With the following inner exception:
"An item with the same key has already been added."
Any ideas on what I could be missing?
© Stack Overflow or respective owner