Ejemplo n.º 1
0
        /// <summary>
        /// get storage
        /// </summary>
        /// <returns></returns>
        internal static IFileStorage GetStorage()
        {
            IConfiguration configuration = new ConfigurationBuilder()
                                           .AddJsonFile(Reflections.GetRootRelativeFile("appsettings.json").FullName, true, true)
                                           .Build();

            var appSettingsSection = configuration.GetSection("AppSettings");

            var appSettings = appSettingsSection.Get <StoragAppSettings>();


            if (appSettings == null || string.IsNullOrEmpty(appSettings.DataPath))
            {
                return(new FileSystemStorage("Default", "../Data"));
            }
            else
            {
                return(new FileSystemStorage("Default", appSettings.DataPath));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Get file relative to base
 /// </summary>
 /// <param name="relativePath"></param>
 /// <returns></returns>
 private FileInfo GetBaseRelativeFile(string relativePath)
 {
     return(Reflections.GetRootRelativeFile($"{DataPath}/{TenantId}/{relativePath}"));
 }