TPC and Unique Primary Keys

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Zautashvili
Posts: 1
Joined: Fri 24 Aug 2012 15:54

TPC and Unique Primary Keys

Post by Zautashvili » Fri 24 Aug 2012 16:00

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

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: TPC and Unique Primary Keys

Post by Shalex » Mon 27 Aug 2012 16:26

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.

Post Reply