using Microsoft.Extensions.DependencyInjection; using AipGateway.API.Domain.IRepositories.IGenericRepositories; using Microsoft.Extensions.Configuration; using AipGateway.API.Infrastructure.DataAccess; using AipGateway.API.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; using AipGateway.API.Infrastructure.Configurations; namespace AipGateway.API.Infrastructure { public static class Dependencyinjection { public static IServiceCollection AddInfrastructureLayerServices(this IServiceCollection services, IConfiguration configuration) { services.Add(new ServiceDescriptor(typeof(ConnectionInfo), new ConnectionInfo(configuration.GetConnectionString("DefaultConnection")))); services.AddDbContext(options => { options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); //ServiceLifetime.Transient; }); services.AddScoped(); return services; } } }