本文整理汇总了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"));
}
示例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);
}
}
}
示例3: Startup
public Startup(IHostingEnvironment env)
{
// Setup configuration sources.
Configuration = new ConfigurationBuilder(env.MapPath(@"..\"))
.AddJsonFile("config.json")
.AddEnvironmentVariables()
.Build();
}
示例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);
}
示例5: GetDatabasePath
private static string GetDatabasePath(IHostingEnvironment env)
{
var path = env.MapPath("databases");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return path;
}
示例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();
}
示例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);
}
示例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";
}
示例9: GetLogPath
private static string GetLogPath(IHostingEnvironment env)
{
var logPath = env.MapPath("log");
if (!Directory.Exists(logPath))
{
Directory.CreateDirectory(logPath);
}
return logPath;
}