gpt4 book ai didi

entity-framework - EF 4.1 升级后的代码第一期

转载 作者:行者123 更新时间:2023-12-04 10:44:13 24 4
gpt4 key购买 nike

好的,所以我刚刚通过 NuGet 升级到 EF Code First 4.1,现在我在 JobSiteContext.cs 类中收到以下构建错误:

“当前上下文中不存在名称‘DbDatabase’”

这是我的代码:

public class JobSiteContext : DbContext
{
public DbSet<JobSite.Models.Job> Jobs { get; set; }

public DbSet<JobSite.Models.Location> Locations { get; set; }

public DbSet<JobSite.Models.Profile> Profiles { get; set; }

public JobSiteContext()
{
// Instructions:
// * You can add custom code to this file. Changes will *not* be lost when you re-run the scaffolder.
// * If you want to regenerate the file totally, delete it and then re-run the scaffolder.
// * You can delete these comments if you wish
// * If you want Entity Framework to drop and regenerate your database automatically whenever you
// change your model schema, uncomment the following line:
DbDatabase.SetInitializer(new DropCreateDatabaseIfModelChanges<JobSiteContext>());
}
}

任何人都可以指出我正确的方向吗?

谢谢保罗

最佳答案

关于entity-framework - EF 4.1 升级后的代码第一期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5422455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com