I try to do an insert in to n:n (SQL Azure based) related tables (UserSet and TenantSet) using the Entity Framework, but it fails with the error: “tables without a clustered index are not supported in this version of sql server”. I’ve used the model first approach to generate the SQL database, so the SQL Server database should be fine.
After extensive search it seems that the table UserTenant has no clustered index. The script that the Entity Framework generate contains (in my opinion) an error. The relevant part of the script is:
Creating primary key on [User_UserId], [Tenant_TenantId] in table ‘UserTenant’
PRIMARYKEY NONCLUSTERED ([User_UserId], [Tenant_TenantId] ASC);
Of course the NONCLUSTERED parameter should me CLUSTERED. Change that and run the script again.
That’s all, hope the Entity Framework team resolves this what looks like a bug.