// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(x => { x.ReturnHttpNotAcceptable = true; }).AddXmlDataContractSerializerFormatters(); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, o => { o.LoginPath = new PathString(@"/api/login/reLogin"); }); services.AddAutoMapper(typeof(CompanyProfile)); Configuration.GetSection("ConfigEntity").Bind(ConfigEntity.Instance); var diTypes = AppDomainTypeFinder.GetSubClassType(typeof(IDIBuilder)); diTypes.Foreach(x => { var instance = (IDIBuilder)Activator.CreateInstance(x); instance.DIBuilder(services); }); }