1

Closed

Can't modify key after convention model builder added entity

description

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.
Closed Dec 14, 2012 at 9:28 PM by HongmeiG
Once we fix http://aspnetwebstack.codeplex.com/workitem/701, user can do this.

comments

HongmeiG wrote Sep 27, 2012 at 10:19 PM

We should detect if someone has called HasKey(), then we should not try to infer the key as ToDoID as the key any more.