Após criar a migração. E quando tento atualizar o banco (update-database) ocorre o seguinte erro:
...
IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
ClientConnectionId:d71595fd-156e-45ea-872b-37230ba63f9a
Error Number:515,State:2,Class:16
Cannot insert the value NULL into column 'PedidoId', table 'CasaDoCodigo.dbo.ItensPedido'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Já adicionei o AddSingleton:
```` public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddDistributedMemoryCache(); services.AddSession(); services.AddSingleton();
string connectionString = Configuration.GetSection("ConnectionStrings") .GetValue("Default"); services.AddDbContext(options => options.UseSqlServer(connectionString));
services.AddTransient(); } ```