【发布时间】:2020-09-11 14:22:16
【问题描述】:
大家好,我的名字是 Taniguchi,我学习 asp.net core,我设法创建了一个迁移,但是当我使用 Update-Database 命令时,显示以下错误:“
指定“-Verbose”标志以查看应用于目标数据库的 SQL 语句。 在程序集“WebApplication1”中找不到迁移配置类型。 (在 Visual Studio 中,您可以使用包管理器控制台中的 Enable-Migrations 命令添加迁移配置)。
我的数据库:
public class MimicContext : DbContext
{
public MimicContext(DbContextOptions<MimicContext> options) : base(options)
{
}
public DbSet<Palavra> Palavras { get; set; }
}
我的创业:
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<MimicContext>(opt =>
{
opt.UseSqlite("Data Source=Database\\Mimic.db");
});
services.AddMvc(options => options.EnableEndpointRouting = false);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
}
}
如何配置迁移到程序集?
【问题讨论】:
标签: c# asp.net-web-api database-migration