/// <summary> /// Initialize engine /// </summary> /// <param name="services">Collection of service descriptors</param> public static void Initialize(IServiceCollection services, IConfiguration configuration) { //set base application path var provider = services.BuildServiceProvider(); var hostingEnvironment = provider.GetRequiredService <IWebHostEnvironment>(); var config = new GrandConfig(); configuration.GetSection("Grand").Bind(config); CommonHelper.WebRootPath = hostingEnvironment.WebRootPath; CommonHelper.BaseDirectory = hostingEnvironment.ContentRootPath; CommonHelper.CacheTimeMinutes = config.DefaultCacheTimeMinutes; CommonHelper.CookieAuthExpires = config.CookieAuthExpires > 0 ? config.CookieAuthExpires : 24 * 365; CommonHelper.AllowToJsonResponse = config.AllowToJsonResponse; //register mongo mappings MongoDBMapperConfiguration.RegisterMongoDBMappings(); //initialize plugins var mvcCoreBuilder = services.AddMvcCore(); //PluginManager.Initialize(mvcCoreBuilder, config); //initialize CTX sctipts //RoslynCompiler.Initialize(mvcCoreBuilder.PartManager, config); }
/// <summary> /// Initialize engine /// </summary> /// <param name="services">Collection of service descriptors</param> public void Initialize(IServiceCollection services) { //set base application path var provider = services.BuildServiceProvider(); var hostingEnvironment = provider.GetRequiredService <IHostingEnvironment>(); var YimiConfig = provider.GetRequiredService <YimiConfig>(); CommonHelper.BaseDirectory = hostingEnvironment.ContentRootPath; //register mongo mappings MongoDBMapperConfiguration.RegisterMongoDBMappings(YimiConfig); //initialize plugins var mvcCoreBuilder = services.AddMvcCore(); PluginManager.Initialize(mvcCoreBuilder.PartManager, YimiConfig); }
/// <summary> /// Register application /// </summary> /// <param name="services">Collection of service descriptors</param> /// <param name="configuration">Configuration</param> private static IMvcCoreBuilder RegisterApplication(IServiceCollection services, IConfiguration configuration) { //add accessor to HttpContext services.AddHttpContextAccessor(); //add wkhtmltopdf services.AddWkhtmltopdf(); //add AppConfig configuration parameters var config = services.StartupConfig <AppConfig>(configuration.GetSection("Application")); //add hosting configuration parameters services.StartupConfig <HostingConfig>(configuration.GetSection("Hosting")); //add api configuration parameters services.StartupConfig <ApiConfig>(configuration.GetSection("Api")); //add grand.web api token config services.StartupConfig <GrandWebApiConfig>(configuration.GetSection("GrandWebApi")); //set base application path var provider = services.BuildServiceProvider(); var hostingEnvironment = provider.GetRequiredService <IWebHostEnvironment>(); var param = configuration["Directory"]; if (!string.IsNullOrEmpty(param)) { CommonPath.Param = param; } CommonPath.WebHostEnvironment = hostingEnvironment.WebRootPath; CommonPath.BaseDirectory = hostingEnvironment.ContentRootPath; CommonHelper.CacheTimeMinutes = config.DefaultCacheTimeMinutes; CommonHelper.CookieAuthExpires = config.CookieAuthExpires > 0 ? config.CookieAuthExpires : 24 * 365; CommonHelper.IgnoreAcl = config.IgnoreAcl; CommonHelper.IgnoreStoreLimitations = config.IgnoreStoreLimitations; //register mongo mappings MongoDBMapperConfiguration.RegisterMongoDBMappings(); var mvcCoreBuilder = services.AddMvcCore(); return(mvcCoreBuilder); }
/// <summary> /// Initialize engine /// </summary> /// <param name="services">Collection of service descriptors</param> public void Initialize(IServiceCollection services) { //set base application path var provider = services.BuildServiceProvider(); var hostingEnvironment = provider.GetRequiredService <IWebHostEnvironment>(); var grandConfig = provider.GetRequiredService <GrandConfig>(); CommonHelper.HostingEnvironment = hostingEnvironment; //register mongo mappings MongoDBMapperConfiguration.RegisterMongoDBMappings(grandConfig); //initialize plugins var mvcCoreBuilder = services.AddMvcCore(); PluginManager.Initialize(mvcCoreBuilder, grandConfig); //initialize CTX sctipts RoslynCompiler.Initialize(mvcCoreBuilder.PartManager, grandConfig); }
/// <summary> /// Initialize engine /// </summary> /// <param name="services">Collection of service descriptors</param> public void Initialize(IServiceCollection services, IConfiguration configuration) { //set base application path var provider = services.BuildServiceProvider(); var hostingEnvironment = provider.GetRequiredService <IWebHostEnvironment>(); var config = new GrandConfig(); configuration.GetSection("Grand").Bind(config); CommonHelper.BaseDirectory = hostingEnvironment.ContentRootPath; //register mongo mappings MongoDBMapperConfiguration.RegisterMongoDBMappings(); //initialize plugins var mvcCoreBuilder = services.AddMvcCore(); PluginManager.Initialize(mvcCoreBuilder, config); //initialize CTX sctipts RoslynCompiler.Initialize(mvcCoreBuilder.PartManager, config); }
public Startup(IConfiguration configuration) { Configuration = configuration; MongoDBMapperConfiguration.RegisterMapping(); }