|
@@ -59,7 +59,7 @@ namespace TEAMModelOS.SDK.DI
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- var cm = CosmosClients.GetOrAdd(name, x => new CosmosClient(_optionsMonitor.Get(name).CosmosConnectionString, new CosmosClientOptions() { ApplicationRegion = region }));
|
|
|
+ var cm = CosmosClients.GetOrAdd(name, x => new CosmosClient(_optionsMonitor.Get(name).ConnectionString, new CosmosClientOptions() { ApplicationRegion = region }));
|
|
|
return cm;
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -95,7 +95,9 @@ namespace TEAMModelOS.SDK.DI
|
|
|
public async Task InitializeDatabase()
|
|
|
{
|
|
|
// string[] DatabaseIds = BaseConfigModel.Configuration.GetSection("Azure:Cosmos:Database").Get<string[]>();
|
|
|
- string[] DatabaseIds =new string[] { "TEAMModelOS" };
|
|
|
+ string[] DatabaseIds =_optionsMonitor.Get("Default").Database;
|
|
|
+
|
|
|
+
|
|
|
bool isMonitor = false;
|
|
|
string leases = "leases";
|
|
|
if (DatabaseIds != null)
|
|
@@ -112,7 +114,7 @@ namespace TEAMModelOS.SDK.DI
|
|
|
}
|
|
|
//获取数据库所有的表
|
|
|
// List<Type> types = ReflectorExtensions.GetAllTypeAsAttribute<CosmosDBAttribute>(BaseConfigModel.Configuration.GetSection("Azure:Cosmos:ScanModel").Get<string[]>() );
|
|
|
- List<Type> types = ReflectorExtensions.GetAllTypeAsAttribute<CosmosDBAttribute>(new string[] { "TEAMModelOS" });
|
|
|
+ List<Type> types = ReflectorExtensions.GetAllTypeAsAttribute<CosmosDBAttribute>(_optionsMonitor.Get("Default").ScanModel);
|
|
|
foreach (Type type in types)
|
|
|
{
|
|
|
string PartitionKey = AzureCosmosUtil.GetPartitionKey(type);
|