0

我正在尝试在 Code Only 之上构建一个 WCF DataService DbContext。但是,一旦我将第一个DbSet属性添加到我DbContext的访问 .svc 时,我就会收到“请求错误”。

我只需要得到这个错误DbContext

public class JukeboxContext : DbContext
{
    public DbSet<Song> Songs { get; set; }
}

然后基于它做一个基本的WCF DataService,当我运行服务时会发生错误。

关于我需要做什么的任何想法?

4

1 回答 1

0

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

于 2011-02-26T18:06:44.247 回答