public async Task <List <EventStorageInfo> > GetEventStorageList(string name, long?createTime) { List <EventStorageInfo> storageList = new List <EventStorageInfo>(); if (this._storageSharding != null) { storageList = await this._storageSharding.GetProviderList(name, StorageType.EventSource, createTime); } else { EventStorageInfo storageInfo = new EventStorageInfo(); storageInfo.EventSource = name; storageInfo.Provider = this._options.StorageProvider; storageInfo.Tables = new List <string>(); storageInfo.Tables.Add(name); storageList.Add(storageInfo); } if (storageList == null || storageList.Count == 0) { throw new ArgumentNullException($"{name} Event source has no storage provider."); } for (int i = 0; i < storageList.Count; i++) { EventStorageInfo storage = storageList[i]; if (storage.Tables == null || storage.Tables.Count == 0) { throw new ArgumentNullException($"{name} Event source does not have a corresponding storage table."); } storage.Tables = storage.Tables.Select(f => StorageTableNameBuild.BuildTableName(f, StorageType.EventSource)).ToList(); storage.Storage = this._serviceProvider.GetRequiredServiceByName <IEventStorage>(storage.Provider); } return(storageList); }
public async Task <string> GetTable(string name, StorageType storageType, string stateKey) { string storageTableName = string.Empty; if (this._storageSharding != null) { storageTableName = await this._storageSharding.GetTable(name, storageType, stateKey); } else { storageTableName = name; } if (string.IsNullOrEmpty(storageTableName)) { throw new ArgumentNullException("Get storage table name from IStorageSharding cannot be empty"); } return(StorageTableNameBuild.BuildTableName(storageTableName, storageType)); }
public async Task <List <string> > GetTableList(string name, StorageType storageType, string stateKey, long?createTime) { List <string> tables = new List <string>(); if (this._storageSharding != null) { tables = await this._storageSharding.GetTableList(name, storageType, stateKey, createTime); } else { if (!string.IsNullOrEmpty(name)) { tables.Add(name); } } if (tables == null || tables.Count == 0) { throw new ArgumentNullException("Get storage table name from IStorageSharding cannot be empty"); } return(tables.Select(f => StorageTableNameBuild.BuildTableName(f, storageType)).ToList()); }