【发布时间】:2011-05-15 07:44:17
【问题描述】:
我创建了一个新的 Entity Frameworks Code First 应用,而 DbSet (People) 返回 null。
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Repository : DbContext
{
public DbSet<Person> People;
}
web.config:连接字符串
<connectionStrings>
<add name="Repository"
connectionString="Data Source=|DataDirectory|Repository.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>
现在当我打电话时
Repository _repo = new Repository()
_repo.People;
_repo.People 将为空
我错过了什么?
- Microsoft.Data.Entity.Ctp.dll 是 引用
- 我已经尝试过 没有数据库初始化程序。
【问题讨论】:
标签: entity-framework code-first ef-code-first