Example #1
0
        IFileStorage CreateStorage()
        {
            FileStorageContext context      = GetContext();
            string             assemblyName = context.GetConfig("storageDriver.assembly");
            string             typeName     = context.GetConfig("storageDriver.type");
            Assembly           assembly     = Assembly.Load(assemblyName);

            IFileStorage storage = (IFileStorage)assembly
                                   .CreateInstance(typeName, true, BindingFlags.Default, null
                                                   , new object[] { context }, null, null);

            return(storage);
        }
Example #2
0
 public MongoStorage(FileStorageContext context)
 {
     this.context     = context;
     connectionString = context.GetConfig("mongoConnectionString") ?? connectionString;
     mongoClient      = new MongoClient(connectionString);
     db = mongoClient.GetDatabase("MongoFileSystem");
 }
Example #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="context"></param>
 public LocalStorage(FileStorageContext context)
 {
     this.context = context;
     rootDir      = context.GetConfig("localRootDirectory") ?? rootDir;
     if (!rootDir.EndsWith("\\"))
     {
         rootDir = rootDir + "\\";
     }
 }