当前位置: 首页>>代码示例>>C#>>正文


C# IHostingEnvironment.MapPath方法代码示例

本文整理汇总了C#中IHostingEnvironment.MapPath方法的典型用法代码示例。如果您正苦于以下问题:C# IHostingEnvironment.MapPath方法的具体用法?C# IHostingEnvironment.MapPath怎么用?C# IHostingEnvironment.MapPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHostingEnvironment的用法示例。


在下文中一共展示了IHostingEnvironment.MapPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apft

        public Apft(IHostingEnvironment environment)
        {
            env = environment;

            /** Store these csv strings on constructor maybe move to db **/
            situpsCsv = System.IO.File.ReadAllText(env.MapPath(@"data/male-situp-standards.csv"));
            pushupsCsv = System.IO.File.ReadAllText(env.MapPath(@"data/male-pushups-standards.csv"));
            twomilerunCsv = System.IO.File.ReadAllText(env.MapPath(@"data/male-2milerun-standards.csv"));
        }
开发者ID:tdmckinn,项目名称:apft-react-ts,代码行数:9,代码来源:Apft.cs

示例2: ScanForTemplates

 private void ScanForTemplates(IHostingEnvironment env, string templateFolder)
 {
     string path = "";
     if (!string.IsNullOrWhiteSpace(area))
     {
         path = $"{area}";
     }
     var rootFolder = Path.Combine(env.MapPath(path));              
     var templateDirectory = new DirectoryInfo(Path.Combine(rootFolder, templateFolder));
     if (templateDirectory.Exists)
     {
         var rootDirectory = new DirectoryInfo(rootFolder);
         var templatePartCount = templateDirectory.FullName.Split('\\').Length;
         var files = templateDirectory.EnumerateFiles("*.html", SearchOption.AllDirectories);
         foreach (FileInfo fi in files)
         {
             var templateName = Path.GetFileNameWithoutExtension(fi.Name).ToLower();
             string[] parts = Path.GetDirectoryName(fi.FullName).Split('\\');
             var t = string.Join("-", parts.Skip(templatePartCount).ToArray()).ToLower();
             string name = templateName;
             if (t.Length > 0)
             {
                 name = $"{t}-{templateName}";
             }
             templates.Add(name, fi.FullName);
         }
     }
 }
开发者ID:asimshah,项目名称:apollo-web,代码行数:28,代码来源:Templates.cs

示例3: Startup

 public Startup(IHostingEnvironment env)
 {
     // Setup configuration sources.
     Configuration = new ConfigurationBuilder(env.MapPath(@"..\"))
         .AddJsonFile("config.json")
         .AddEnvironmentVariables()
         .Build();
 }
开发者ID:hackathonvixion,项目名称:ApplicationInsights-aspnet5,代码行数:8,代码来源:Startup.cs

示例4: JsonLocalizationCache

 public JsonLocalizationCache(IHostingEnvironment hostingEnvironment, IFileSystem fileSystem, ILoggerFactory loggerFactory)
 {
     _path = hostingEnvironment.MapPath(@"json");
     _fileSystem = fileSystem;
     _logger = loggerFactory.CreateLogger<JsonLocalizationCache>();
     _fileSystem.CreateDirectory(_path);
     _fileSystem.Watch(_path, "*.json", OnChanged);
 }
开发者ID:jakvike,项目名称:Localization,代码行数:8,代码来源:JsonLocalizationCache.cs

示例5: GetDatabasePath

 private static string GetDatabasePath(IHostingEnvironment env)
 {
     var path = env.MapPath("databases");
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     return path;
 }
开发者ID:asimshah,项目名称:apollo-web,代码行数:9,代码来源:DataContextFactory.cs

示例6: Startup

 public Startup(IHostingEnvironment env, IApplicationEnvironment application)
 {
     // Setup Configuration
     configuration = new ConfigurationBuilder()
         .AddJsonFile(env.MapPath("App_Data/config.json"))
         .AddUserSecrets("Openchain.Server")
         .AddEnvironmentVariables()
         .Build();
 }
开发者ID:pinnpe,项目名称:openchain,代码行数:9,代码来源:Startup.cs

示例7: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            // Configure the HTTP request pipeline.
            app.UseStaticFiles();

            // Add MVC to the request pipeline.
            app.UseCors("AllowAll");
            app.UseMvc();

            string path = env.MapPath("App_Data/mondial.xml");
            World.Create(path);
        }
开发者ID:drjofu,项目名称:AureliaMondial,代码行数:13,代码来源:Startup.cs

示例8: Startup

        public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
        {
            // Set up configuration sources.
            var builder = new ConfigurationBuilder()
                .AddJsonFile("appsettings.json")
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            if (env.IsDevelopment())
            {
                // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets();
            }

            AlarmSystemRepository.RepositoryFile = env.MapPath("AlarmSystemInfo.json");
            OauthRepository.RepositoryFile = env.MapPath("SmartThings.json");
            MyLogger.LogFileName = env.MapPath("LogMessages.txt");
            
            builder.AddEnvironmentVariables();
            Configuration = builder.Build();
            Configuration["Data:DefaultConnection:ConnectionString"] = [email protected]"Data Source={appEnv.ApplicationBasePath}/j64.AlarmServer.db";

        }
开发者ID:R-OG,项目名称:j64.AlarmServer,代码行数:22,代码来源:Startup.cs

示例9: GetLogPath

 private static string GetLogPath(IHostingEnvironment env)
 {
     var logPath = env.MapPath("log");
     if (!Directory.Exists(logPath))
     {
         Directory.CreateDirectory(logPath);
     }
     return logPath;
 }
开发者ID:asimshah,项目名称:apollo-web,代码行数:9,代码来源:Logger.cs


注:本文中的IHostingEnvironment.MapPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。