public void ConfigureServices(IServiceCollection services) { // try to enable dynamic razor compiling - still WIP new StartUpRazorPages().ConfigureServices(services); // enable webapi - include all controllers in the Sxc.Mvc assembly services.AddControllers(options => { options.AllowEmptyInputInBodyModelBinding = true; }) // This is needed to preserve compatibility with previous api usage .AddNewtonsoftJson(options => { // this ensures that c# objects with Pascal-case keep that options.SerializerSettings.ContractResolver = new DefaultContractResolver(); Eav.ImportExport.Json.JsonSettings.Defaults(options.SerializerSettings); }); // enable use of UrlHelper for AbsolutePath services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); services.AddSingleton <IUrlHelperFactory, UrlHelperFactory>(); Factory.UseExistingServices(services); Factory.ActivateNetCoreDi(services2 => { services2 .AddSxcOqtane() .AddSxcRazor() .AddAdamWebApi <int, int>() .AddSxcWebApi() .AddSxcCore() .AddEav(); }); var sp = services.BuildServiceProvider(); // STV // var connectionString = Configuration.GetConnectionString("DefaultConnection"); // 2dm var connectionString = Configuration.GetConnectionString("SiteSqlServer"); sp.Build <IDbConfiguration>().ConnectionString = connectionString; var hostingEnvironment = sp.Build <IHostEnvironment>(); sp.Build <IGlobalConfiguration>().GlobalFolder = Path.Combine(hostingEnvironment.ContentRootPath, "wwwroot\\Modules\\ToSic.Sxc"); // 2sxc Oqtane blob services for Imageflow. services.AddImageflowOqtaneBlobService(); // 2sxc Oqtane dyncode app api. services.AddAppApi(); }
public void ConfigureServices(IServiceCollection services) { // try to enable dynamic razor compiling - still WIP new StartUpRazorPages().ConfigureServices(services); // enable webapi - include all controllers in the Sxc.Mvc assembly services.AddControllers(options => { options.AllowEmptyInputInBodyModelBinding = true; }) // This is needed to preserve compatibility with previous api usage .AddNewtonsoftJson(options => { // this ensures that c# objects with Pascal-case keep that options.SerializerSettings.ContractResolver = new DefaultContractResolver(); Eav.ImportExport.Json.JsonSettings.Defaults(options.SerializerSettings); }); //.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(SxcMvc).Assembly)); // enable use of UrlHelper for AbsolutePath services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); services.AddSingleton <IUrlHelperFactory, UrlHelperFactory>(); Factory.UseExistingServices(services); Factory.ActivateNetCoreDi(services2 => { services2 .AddSxcOqtane() .AddSxcRazor() .AddAdamWebApi <int, int>() .AddSxcWebApi() .AddSxcCore() .AddEav(); }); var connectionString = Configuration.GetConnectionString("SiteSqlServer"); services.BuildServiceProvider().Build <IDbConfiguration>().ConnectionString = connectionString; }