using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); }
using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; public void ConfigureServices(IServiceCollection services) { services.AddDbContextThis example shows how to add an in-memory database to the application using the `UseInMemoryDatabase` method. This is typically used for testing or for applications that do not require persistent data storage. The package library for this feature is `Microsoft.Extensions.DependencyInjection`.(options => options.UseInMemoryDatabase("TestDb")); }