// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { OptionsConfigurationServiceCollectionExtensions.Configure <ConnectionConfig>(services, Configuration.GetSection("ConnectionStrings")); services.AddScoped <IBuhService, BuhServiceClient>(); services.AddMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Setup options with DI services.AddOptions(); // Configure ConnectionStrings using config //services.Configure<ConnectionStrings>(Configuration); OptionsConfigurationServiceCollectionExtensions.Configure <ConnectionStrings>(services, Configuration.GetSection("ConnectionStrings")); services.AddTransient <IReviewDataProvider, ReviewDataProvider>(); services.AddMvc(); }
public void ConfigureServices(IServiceCollection services) { OptionsConfigurationServiceCollectionExtensions.Configure <EventStoreSettings>(services, Configuration.GetSection("EventStore")); services.AddMvc(); var erden = new ErdenConfig(services) .UseDefaultCommandBus() .UseDefaultDataStorage() .UseDefaultEventBus() .AddEventStoreTarget <EventStoreTarget>(); erden.Build(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); OptionsConfigurationServiceCollectionExtensions.Configure <FslConfiguration>( services, Configuration.GetSection("FslConfiguration")); services.AddSingleton <IConfigService, NetCoreConfigService>(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSingleton(Configuration); OptionsConfigurationServiceCollectionExtensions.Configure <MongoDBSettings>(services, Configuration.GetSection("MongoDBSettings")); services.AddScoped <IOfertaRepository, OfertaRepository>(); services.AddCors(); services.AddMvc(options => { }).AddJsonOptions(options => { options.SerializerSettings.DateFormatString = ISO_8861_DateTimeFormat; options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); OptionsConfigurationServiceCollectionExtensions.Configure <AppSettings>(services, Configuration.GetSection("AppSettings")); services.AddTransient <ILocationContextFactory, LocationContextFactory>(); services.AddTransient <ILocationDataService, LocationDataService>(); services.AddTransient <ILocationSnapshotDataService, LocationSnapshotDataService>(); services.AddTransient <IFileSystemService, FileSystemService>(); services.AddTransient <IImageService, ImageService>(); Mapper.Initialize(cfg => { cfg.CreateMap <Location, LocationDto>().ForMember(dest => dest.SnapshotsCount, opt => opt.MapFrom(src => src.LocationSnapshots.Count())); cfg.CreateMap <LocationForCreationDto, Location>(); cfg.CreateMap <LocationForUpdateDto, Location>(); cfg.CreateMap <LocationSnapshot, LocationSnapshotDto>(); cfg.CreateMap <LocationSnapshotForCreationDto, LocationSnapshot>(); cfg.CreateMap <LocationSnapshotForUpdateDto, LocationSnapshot>(); cfg.CreateMap <SnapshotGroup, SnapshotGroupDto>(); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddOptions(); // Add Cors services.AddCors(o => o.AddPolicy("AllowSpecificOrigin", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.Configure <MvcOptions>(options => { options.Filters.Add(new CorsAuthorizationFilterFactory("AllowSpecificOrigin")); }); OptionsConfigurationServiceCollectionExtensions.Configure <WeatherConfig>(services, Configuration.GetSection("ConnectionStrings")); }
// 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 <logdemoContext>(OptionsConfigurationServiceCollectionExtensions => OptionsConfigurationServiceCollectionExtensions.UseMySQL("Server=localhost;Port=3306;Database=demo3;UserID=root;Password=root;SslMode=None")); services.AddMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); OptionsConfigurationServiceCollectionExtensions.Configure <RedisConfig>(services, Configuration.GetSection("ConnectionStrings:Redis")); OptionsConfigurationServiceCollectionExtensions.Configure <DBConfig>(services, Configuration.GetSection("ConnectionStrings:JCDB")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddScoped <IPermissionRepository, PermissionRepository>(); services.AddScoped <IRoleRepository, RoleRepository>(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IUnitOfWork, UnitOfWork>(); services.AddAutoMapper(); services.AddDbContext <PmgaDbContext>(OptionsConfigurationServiceCollectionExtensions => OptionsConfigurationServiceCollectionExtensions.UseSqlServer(Configuration.GetConnectionString("Default"))); services.AddCors(); services.AddMvc(); // }