Composite keys can be specified by placing a comma between the two column names in the [PrimaryKey] attribute.
[PrimaryKey]
[TableName("Users")] [PrimaryKey("UserId,UserName")] public class User { public int UserId { get; set; } public string UserName { get;set; } }
When setting a composite key, the AutoIncrement attribute will always default false.
false
If you want to get one of these objects from the database using the SingleById group of methods then you can use an anonymous type.
SingleById
IDatabase db = new Database("connStringName"); var user = db.SingleById<User>(new {UserId = 1, UserName = "user"});
There was an error while loading. Please reload this page.