コード例 #1
0
        public static string AddFile(DataConfig providerConfig, POCO.NTFSFile ntfsFile)
        {
            switch (providerConfig.ProviderType)
            {
            case "azure.tableservice":

                AzureNTFSFile az = new AzureNTFSFile(ntfsFile);

                CloudTable     table     = Utils.GetCloudTable(providerConfig, NTFS.AzureTableNames.NTFSFiles);
                TableOperation operation = TableOperation.InsertOrMerge(az);
                Task           tUpdate   = table.ExecuteAsync(operation);
                tUpdate.Wait();

                break;

            case "internal.mongodb":
                IMongoCollection <MongoNTFSFile> collection = Utils.GetMongoCollection <MongoNTFSFile>(providerConfig, MongoTableNames.NTFSFiles);
                MongoNTFSFile mongoObject = Utils.ConvertType <MongoNTFSFile>(ntfsFile);
                collection.InsertOne(mongoObject);
                return(string.Empty);

            default:
                throw new ApplicationException("Data provider not recognised: " + providerConfig.ProviderType);
            }

            //TODO return id of new object if supported
            return(string.Empty);
        }
コード例 #2
0
        public static bool ForceRescan(DataConfig providerConfig, POCO.NTFSFile file)
        {
            POCO.FileBatchStatus batchstatus = new FileBatchStatus(file.PartitionKey, file.RowKey);
            batchstatus.BatchGuid             = Guid.Empty;
            batchstatus.BatchStatus           = string.Empty;
            batchstatus.JsonFileProcessResult = "{}";

            DataFactory.File.UpdateFileBatchStatus(providerConfig, batchstatus, "ntfsfiles");

            return(true);
        }