예제 #1
0
        public static bool ForceRescan(DataConfig providerConfig, POCO.SharePoint.SPFile file)
        {
            POCO.FileBatchStatus batchstatus = new FileBatchStatus(file.PartitionKey, file.RowKey);
            batchstatus.BatchGuid             = Guid.Empty;
            batchstatus.BatchStatus           = string.Empty;
            batchstatus.JsonFileProcessResult = "{}";

            string tableName = string.Empty;

            switch (providerConfig.ProviderType)
            {
            case "azure.tableservice":
                tableName = POCO.TableNames.Azure.SharePoint.SPFile;
                break;

            case "internal.mongodb":
                tableName = POCO.TableNames.Mongo.SharePoint.SPFile;
                break;

            default:
                throw new ApplicationException("Unknown provider type: " + providerConfig.ProviderType);
                break;
            }

            DataFactory.File.UpdateFileBatchStatus(providerConfig, batchstatus, tableName);

            return(true);
        }
예제 #2
0
        public static string AddFile(DataConfig providerConfig, POCO.SharePoint.SPFile spFile)
        {
            switch (providerConfig.ProviderType)
            {
            case "azure.tableservice":

                AzureSharePointFile az = new AzureSharePointFile(spFile);

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

                break;

            case "internal.mongodb":
                IMongoCollection <MongoSharePointFile> collection = Utils.GetMongoCollection <MongoSharePointFile>(providerConfig, MongoTableNames.SPFile);
                MongoSharePointFile mongoObject = Utils.ConvertType <MongoSharePointFile>(spFile);
                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);
        }