// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); // Add framework services. //services.AddDbContext<MicaContext>(options => // options.UseSqlServer(config.GetConnectionString("MicaConnection"))); services.AddIdentity <IdentityUser, IdentityRole>() .AddEntityFrameworkStores <MicaContext>() .AddDefaultTokenProviders(); services.AddMvc().AddJsonOptions(jsonOptions => { jsonOptions.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; }); services.AddOptions(); // Create the IServiceProvider based on the container. ContainerManager = new AutofacIoCManager(); return(ContainerManager.PopulateAndGetServiceProvider(services)); }
// ConfigureServices is where you register dependencies. This gets // called by the runtime before the Configure method, below. public IServiceProvider ConfigureServices(IServiceCollection services) { // Add services to the collection. services.AddMvc(); // Create the IServiceProvider based on the container. ContainerManager = new AutofacIoCManager(); return(ContainerManager.PopulateAndGetServiceProvider(services)); }