я потом вызову в program.cs?
Типа такого
namespace Infrastructure
{
public static class DependencyInjection
{
public static IServiceCollection AddPersistance(this IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<FarmDBContext>(options =>
options.UseSqlite(configuration.GetConnectionString("MyDatabase"), b =>
b.MigrationsAssembly(typeof(FarmDBContext).Assembly.FullName)), ServiceLifetime.Transient);
return services;
}
}
}
Обсуждают сегодня