0
みなさん、 私のconnectionStringで何か問題があります。私は私のconnectionStringに問題があります。移行できない
InitialModel
DOTNETのEFの移行を入力して、移行を追加しようとすると、私は次のエラーを取得します。
Value cannot be null. Parameter name: connectionString
これはStartup.cs
public void ConfigureServices(IServiceCollection services) { services.AddDbContext<VegaDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddMvc(); }
に私のコードですこれはこれは私のDbContextあるappsettings.json
{ "ConnectionStrings":{ "Default": "server=localhost; database=vega; Integrated Security=SSPI" }, "Logging": { "IncludeScopes": false, "Debug": { "LogLevel": { "Default": "Warning" } }, "Console": { "LogLevel": { "Default": "Warning" } } } }
に私のコードです。
using Microsoft.EntityFrameworkCore; namespace vega.Persistence { public class VegaDbContext : DbContext { public VegaDbContext(DbContextOptions<VegaDbContext>options) :base(options) { } } }
ありがとう、問題が解決しました。 – Sushi