123456789101112131415161718192021222324252627 |
- 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<ApplicationDbContext>(options =>
- {
- options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
- //ServiceLifetime.Transient;
- });
-
- services.AddScoped<IUnitOfWork, UnitOfWorkRepository>();
- return services;
- }
- }
- }
|