// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <d1000DataContext>(options => { options.UseLoggerFactory(_myLoggerFactory) .UseSqlServer(Configuration["ConnectionStrings:ConexaoPadrao"]); }); // Adiciona todos os mapeamentos das viewmodels services.AddAutoMapper( //Shared typeof(Shared.Application.ConfigurationProfile).GetTypeInfo().Assembly, //SNGPC typeof(Common.Application.ConfigurationProfile).GetTypeInfo().Assembly ); #region Injeção de Dependência // Base Configuracao.InjecaoDependencia(services); #endregion services.AddMemoryCache(); services.AddCors(); services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null); services.AddMvc() .AddFluentValidation(fv => fv.RegisterValidatorsFromAssembly(Assembly.GetAssembly(typeof(LogradouroValidator)))) .AddMvcOptions(f => f.EnableEndpointRouting = false); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <AdminContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Context"))); services.AddMvc(); services.AddDistributedMemoryCache(); services.AddAutoMapper(typeof(ConfigurationProfile).GetTypeInfo().Assembly, typeof(ConfigurationProfile).GetTypeInfo().Assembly); Configuracao.InjecaoDependencia(services); }
public InicializacaoFixture() { var serviceProvider = new ServiceCollection(); Configuracao.InjecaoDependencia(serviceProvider); serviceProvider.AddAutoMapper(typeof(FileSys.Retaguarda.Application.Admin.ConfigurationProfile).GetTypeInfo().Assembly); serviceProvider.AddDbContext <RetaguardaAdminContext>(options => options.UseInMemoryDatabase("Retaguarda")); Container = serviceProvider.BuildServiceProvider(); var context = Container.GetService <RetaguardaAdminContext>(); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddDbContext <RetaguardaAdminContext>(options => options.UseSqlServer(Configuration.GetConnectionString("RetaguardaContext"))); services.AddDbContext <RetaguardaAcessoContext>(options => options.UseSqlServer(Configuration.GetConnectionString("RetaguardaContext"))); services.AddMvc(); services.AddDistributedMemoryCache(); services.AddSession(); services.AddAutoMapper(typeof(FileSys.Retaguarda.Application.Admin.ConfigurationProfile).GetTypeInfo().Assembly, typeof(FileSys.Retaguarda.Application.Acesso.ConfigurationProfile).GetTypeInfo().Assembly); Configuracao.InjecaoDependencia(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddDistributedMemoryCache(); Configuracao.InjecaoDependencia(services); }