forked from ddrilling/AsbCloudServer
Merge branch 'dev' into feature/#13123485--import-fact-trajectories
This commit is contained in:
commit
04b2fd4a0d
@ -47,15 +47,6 @@ namespace AsbCloudInfrastructure
|
|||||||
|
|
||||||
public static class DependencyInjection
|
public static class DependencyInjection
|
||||||
{
|
{
|
||||||
public static IAsbCloudDbContext MakeContext(string connectionString)
|
|
||||||
{
|
|
||||||
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
||||||
.UseNpgsql(connectionString)
|
|
||||||
.Options;
|
|
||||||
var context = new AsbCloudDbContext(options);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MapsterSetup()
|
public static void MapsterSetup()
|
||||||
{
|
{
|
||||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||||
@ -306,19 +297,5 @@ namespace AsbCloudInfrastructure
|
|||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddTransientLazy<TService, TImplementation>(this IServiceCollection services)
|
|
||||||
where TService : class
|
|
||||||
where TImplementation : class, TService
|
|
||||||
=> services.AddTransient<TService, TImplementation>()
|
|
||||||
.AddTransient(provider => new Lazy<TService>(provider.GetRequiredService<TService>));
|
|
||||||
|
|
||||||
public static IServiceCollection AddTransientLazy<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory)
|
|
||||||
where TService : class
|
|
||||||
where TImplementation : class, TService
|
|
||||||
=> services.AddTransient<TService, TImplementation>(implementationFactory)
|
|
||||||
.AddTransient(provider => new Lazy<TService>(() => implementationFactory(provider)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user