Page 1 of 1

TPC and Unique Primary Keys

Posted: Fri 24 Aug 2012 16:00
by Zautashvili
I have a big problem here. EF 5.0 Code First keeps complaining when using TPC inheritance mapping saying:

All objects in the EntitySet 'EntitySet' must have unique primary keys

Even if I make separate sets for the derived types. e.g.:

I do this:

public DbSet<ProviderCompany> ProviderCompanies { get; set; }

public DbSet<Bank> Banks { get; set; }

Both, Bank and ProviderCompany derive from Company base class.

Then I do this:

var c1 = context.ProviderCompanies.ToList();
var c2 = context.Banks.ToList();

I have provider companies and banks with same Ids, and it throws the exception:

All objects in the EntitySet 'TestContext.Companies' must have unique primary keys
though I don't have a set named Companies.

I cannot find the solution, please help.

Thanks,

Giorgi

Re: TPC and Unique Primary Keys

Posted: Mon 27 Aug 2012 16:26
by Shalex
Could you please send us a small test project so that we can reproduce the error in our environment? Also specify the name and the version (x.xx.xxx) of your dotConnect provider.