Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Commented Issue: Can't modify key after convention model builder added entity [471]

$
0
0
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: We should detect if someone has called HasKey(), then we should not try to infer the key as ToDoID as the key any more.

Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>