WCF DataService with EF CTP 5 CodeOnly DbContext
I am trying to build a WCF DataService on top of a Code Only DbContext
. However as soon as I add the first DbSet
property to my DbContext
I get "Request Error" when accessing the .svc.
All I need to get 开发者_StackOverflow中文版the error is to have this DbContext
:
public class JukeboxContext : DbContext
{
public DbSet<Song> Songs { get; set; }
}
and then do a basic WCF DataService based on it, and the error happens when i run the service.
Any ideas on what I need to do?
Turnes out the exception means that it can't resolve which field is the primary key. The easy way to go is to name it ID or ID - otherwise the DataServiceKey attribute will let you use composite keys
精彩评论