[TableName("Example")]
[PrimaryKey("One,Two")]
public class Example {
public int One {get;set;}
public int Two {get;set;}
}
Expectation:
I would expect the table Example to include a Primary Key comprised of both columns One and Two.
I'm using this code with the Umbraco CMS. There could be an issue in Umbraco.CMS.Infrastructure.Migrations.Expressions.Common that is not handling the composite key when the table is created. I'd greatly appreciate it if someone can help me confirm my approach is right/wrong before I open a ticket there. Thank you!
I'm closing this issue. Whatever problems I'm having with the composite primary key, it's between my code and the Umbraco CMS. I've successfully tested NPoco in a separate project. TY, and sorry for the trouble!
Versions:
NPoco 5.3.2 NPoco.SqlServer 5.3.2 Microsoft.Data.SqlClient 3.0.0
Sample Class:
Expectation:
I would expect the table
Example
to include aPrimary Key
comprised of both columnsOne
andTwo
.Result:
Wiki Reference:
I built the example code above using the following Wiki page as a reference.