// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ProjectContext>( opt => opt.UseSqlServer(@"Server=DESKTOP-7C55TUR;Database=ProjectDB;Trusted_Connection=True;")); IdentityStartup.ConfigureServices(services, HostingEnvironment, Configuration); services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddMvc() .AddJsonOptions(o => o.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); #region Services injections services.AddSingleton <IConfiguration>(o => Configuration); services.AddScoped <ProjectContext>(); services.AddScoped <LikeService>(); services.AddScoped <PostService>(); services.AddScoped <CommentService>(); services.AddScoped <IAppContext, ProjectAppContext>(); AutoMapperConfig.RegisterMappings(services.BuildServiceProvider()); #endregion Services injections }
public Startup(IConfiguration configuration, IHostingEnvironment env) { Configuration = configuration; if (env.IsDevelopment()) { this.developmentEnvironment = true; } identityStartup = new IdentityStartup(configuration, this.developmentEnvironment); dataStartup = new DataStartup(); apiStartup = new ApiStartup(); servicesStartup = new ServicesStartup(); }
public void Init(IConfiguration configuration, IWebHostEnvironment env) { this.Configuration = configuration; this.CurrentEnvironment = env; if (env.IsDevelopment()) { this.developmentEnvironment = true; } identityStartup = new IdentityStartup(configuration, this.developmentEnvironment); dataStartup = new DataStartup(); apiStartup = new ApiStartup(); servicesStartup = new ServicesStartup(); }
public void Configuration(IAppBuilder app) { IdentityStartup.ConfigureAuth(app); }