// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); //Setup para configuração do Swagger SwaggerConfiguration.AddSwagger(services); //Setup para configuração do EntityFramework EntityFrameworkConfiguration.AddEntityFramework(services, Configuration); //Setup para configuração do JWT JwtConfiguration.ConfigureServices(services, Configuration); //Setup para o MongoDB MongoDBConfiguration.AddMongoDBSetup(services, Configuration); //Injeção de dependência DependencyInjectionConfiguration.AddDependencyInjection(services); //Setup para o MediatR MediatRConfiguration.AddMediatRSetup(services); //Setup para o AutoMapper AutoMapperConfiguration.AddAutoMapperSetup(services); //Setup para o CORS CorsConfiguration.AddCors(services); }
public static void ConfigureDependencyInjection(HttpConfiguration config) { var builder = new ContainerBuilder(); // Register your Web API controllers. builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); builder.RegisterModule <AutoFacModule>(); // OPTIONAL: Register the Autofac filter provider. builder.RegisterWebApiFilterProvider(config); // OPTIONAL: Register the Autofac model binder provider. builder.RegisterWebApiModelBinderProvider(); builder.RegisterMediatR(MediatRConfiguration.GetAssemblies()); // Set the dependency resolver to be Autofac. var container = builder.Build(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); var autofacServiceLocator = new AutofacServiceLocator(container); ServiceLocator.SetLocatorProvider(() => autofacServiceLocator); }
public void ConfigureServices(IServiceCollection services) { MvcConfiguration.Configure(services); MediatRConfiguration.Configure(services); JwtAuthenticationConfiguration.Configure(services); WebApiDIConfiguration.RegisterAspWebApiDependencies(services); AutomapperConfiguration.ConfigureAutomapper(services); }
public Startup(IConfiguration configuration, IHostingEnvironment hostingEnvironment) { Configuration = configuration; HostingEnvironment = hostingEnvironment; MvcConfiguration = new MvcConfiguration(); MediatRConfiguration = new MediatRConfiguration(); JwtAuthenticationConfiguration = new JwtAuthenticationConfiguration(configuration); AutomapperConfiguration = new AutomapperConfiguration(); WebApiDIConfiguration = new WebApiDIConfiguration(configuration); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); MediatRConfiguration.Register(services); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Description = "Miller Bordeau API", TermsOfService = new Uri("https://*****:*****@miller-insurance.com" } }); // Set the comments path for the Swagger JSON and UI. var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); }
public MediatRModule(MediatRConfiguration mediatRConfiguration) { this.mediatRConfiguration = mediatRConfiguration; }