// 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); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Mobile phones API", Version = "v1" }); c.EnableAnnotations(); }); MapperInitializer.MapperConfiguration(); services.AddScoped <IImageService, ImageService>(service => new ImageService(Configuration.GetValue <string>("ImagesFolderName"), _loggerFactory.CreateLogger <ImageService>())); services.AddScoped <IMobilePhoneService, MobilePhoneService>(); services.AddScoped <IMobilePhonesJsonRepository, MobilePhonesRepository>(service => new MobilePhonesRepository(Configuration.GetValue <string>("DataFilePath"))); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); MapperInitializer.MapperConfiguration(); //services.AddDbContext<QuartzDataContext>(ServiceLifetime.Singleton); services.AddDbContext <QuartzDataContext>(options => { options.UseSqlServer("Server=10.0.130.5;Database=DB_Scheduler;User Id=pirischeduler;Password=pirischeduler5*", opt => { opt.EnableRetryOnFailure(); opt.CommandTimeout(3000); }); }, ServiceLifetime.Singleton); services.AddSingleton <IHttpHelper, HttpHelper>(); services.AddTransient <IJobService, JobService>(); services.AddTransient <IScheduleJob, QuartzService>(); services.AddLogging(); services.UseQuartz(typeof(SimpleTestProcess)); services.AddSwaggerGen(c => { c.SwaggerDoc("v1.0", new Info { Title = "Scheduler API", Version = "1.0", Description = @"REST services for managing your API ecosystem. ## Quartz ## Manages your scheduled jobs via API.Adds new job , pausing all , resuming all etc." , Contact = new Contact() { Name = "Piri Medya", Url = "http://pirimedya.com/", Email = "*****@*****.**" } }); c.CustomSchemaIds(x => x.FullName); c.IncludeXmlComments($"{_environment.WebRootPath}\\Piri.Framework.Scheduler.Quartz.xml", true); c.UseReferencedDefinitionsForEnums(); }); Console.WriteLine("deneme"); }
// 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; }); services.AddDbContext <DAL.BlogHostingDbContext>(options => options.UseLazyLoadingProxies() .UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <DAL.BlogHostingDbContext>() .AddDefaultTokenProviders(); services.Configure <IdentityOptions>(options => { // Set your identity Settings here (password length, etc.) }); services.AddLocalization(options => options.ResourcesPath = "Resources"); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1) .AddDataAnnotationsLocalization() .AddViewLocalization(); services.Configure <RequestLocalizationOptions>(options => { var supportedCultures = new[] { new CultureInfo("en"), new CultureInfo("de"), new CultureInfo("ru") }; options.DefaultRequestCulture = new RequestCulture("ru"); options.SupportedCultures = supportedCultures; options.SupportedUICultures = supportedCultures; }); services.AddMvcCore().AddJsonFormatters(); services.ConfigureApplicationCookie(options => { options.LoginPath = $"/account/login"; options.LogoutPath = $"/account/logout"; options.AccessDeniedPath = $"/account/access-denied"; }); services.AddSignalR(o => { o.EnableDetailedErrors = true; }); services.AddAuthorization(options => { options.AddPolicy("OwnerPolicy", policy => policy.Requirements.Add(new OwnerRequirement())); options.AddPolicy("ModeratorPolicy", policy => policy.Requirements.Add(new ModeratorRequirement())); }); services.AddScoped <IAuthorizationHandler, BlogOwnerAuthorizationHandler>(); services.AddScoped <IAuthorizationHandler, PostOwnerAuthorizationHandler>(); services.AddScoped <IAuthorizationHandler, CommentOwnerAuthorizationHandler>(); services.AddScoped <IAuthorizationHandler, BlogModeratorAuthorizationHandler>(); MapperInitializer.MapperConfiguration(); services.AddScoped <IUserRepository, UserRepository>(); services.AddScoped <IBlogRepository, BlogRepository>(); services.AddScoped <IPostRepository, PostRepository>(); services.AddScoped <IAuthenticateService, AuthenticateService>(); services.AddScoped <IAccountService, AccountService>(); services.AddScoped <IBlogService, BlogService>(); services.AddScoped <IPostService, PostService>(); services.AddSingleton <IImageService, ImageService>(); services.AddSignalR(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <PYSDataContext>(); services.AddMvc(); MapperInitializer.MapperConfiguration(); }