After ODataConventionModelBuilder add an entity, user can't change the key property to another one.
For example:
public class Todo
{
public int TodoID { get; set; }
public string Name { get; set; }
}
var builder = new ODataConventionModelBuilder();
var todoes = builder.EntitySet<Todo>("Todo");
todoes.EntityType.HasKey(t => t.Name);
It will add another compound primary key to the model but there is no way to remove the TodoID from primary key.
Comments: Once we fix http://aspnetwebstack.codeplex.com/workitem/701, user can do this.
For example:
public class Todo
{
public int TodoID { get; set; }
public string Name { get; set; }
}
var builder = new ODataConventionModelBuilder();
var todoes = builder.EntitySet<Todo>("Todo");
todoes.EntityType.HasKey(t => t.Name);
It will add another compound primary key to the model but there is no way to remove the TodoID from primary key.
Comments: Once we fix http://aspnetwebstack.codeplex.com/workitem/701, user can do this.