Quellcode durchsuchen

修改FindByDict及升级IAzureTableDBRepository DI为AddScoped

CrazyIter vor 5 Jahren
Ursprung
Commit
725a23ebb6
24 geänderte Dateien mit 158 neuen und 110 gelöschten Zeilen
  1. 1 1
      TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs
  2. 1 1
      TEAMModelOS.SDK/Extension/MessagePush/Model/SmsConfig.cs
  3. 1 1
      TEAMModelOS.SDK/Module/AzureBlob/Configuration/BlobClientSingleton.cs
  4. 1 1
      TEAMModelOS.SDK/Module/AzureBlob/Container/AzureBlobModel.cs
  5. 0 3
      TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs
  6. 10 7
      TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs
  7. 1 1
      TEAMModelOS.SDK/Module/AzureCosmosDB/Interfaces/IAzureCosmosDBRepository.cs
  8. 0 2
      TEAMModelOS.SDK/Module/AzureTable/Configuration/AzureTableOptions.cs
  9. 1 2
      TEAMModelOS.SDK/Module/AzureTable/Configuration/HaBookTableContinuationToken.cs
  10. 1 2
      TEAMModelOS.SDK/Module/AzureTable/Configuration/TableClientSingleton.cs
  11. 120 74
      TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs
  12. 1 1
      TEAMModelOS.SDK/Module/AzureTable/Interfaces/IAzureTableDBRepository.cs
  13. 2 0
      TEAMModelOS.SDK/TEAMModelOS.SDK.csproj
  14. 1 1
      TEAMModelOS.Service/Models/Core/LoginInfo.cs
  15. 1 1
      TEAMModelOS.Service/Models/Core/ResourceReference.cs
  16. 1 1
      TEAMModelOS.Service/Models/Syllabus/KnowledgeBlock.cs
  17. 1 1
      TEAMModelOS.Service/Models/Syllabus/KnowledgeBlockPoint.cs
  18. 1 1
      TEAMModelOS.Service/Models/Syllabus/KnowledgePoint.cs
  19. 1 1
      TEAMModelOS/Controllers/Core/StudentController.cs
  20. 2 2
      TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs
  21. 2 2
      TEAMModelOS/Controllers/Syllabus/ResourceController.cs
  22. 1 1
      TEAMModelOS/Controllers/Syllabus/SyllabusController.cs
  23. 1 1
      TEAMModelOS/Controllers/Syllabus/VolumeController.cs
  24. 6 2
      TEAMModelOS/Startup.cs

+ 1 - 1
TEAMModelOS.SDK/Extension/JwtAuth/Models/JwtBlackRecord.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;

+ 1 - 1
TEAMModelOS.SDK/Extension/MessagePush/Model/SmsConfig.cs

@@ -1,5 +1,5 @@
 
 
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 
 
 namespace TEAMModelOS.SDK.Extension.MessagePush.Model
 namespace TEAMModelOS.SDK.Extension.MessagePush.Model
 {
 {

+ 1 - 1
TEAMModelOS.SDK/Module/AzureBlob/Configuration/BlobClientSingleton.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage;
+
 using Microsoft.WindowsAzure.Storage.Blob;
 using Microsoft.WindowsAzure.Storage.Blob;
 using System;
 using System;
 
 

+ 1 - 1
TEAMModelOS.SDK/Module/AzureBlob/Container/AzureBlobModel.cs

@@ -1,6 +1,6 @@
 
 
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System;
 using System;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using System.IO;
 using System.IO;

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 3
TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs


+ 10 - 7
TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs

@@ -24,6 +24,9 @@ using System.Text;
 using TEAMModelOS.SDK.Helper.Common.ReflectorExtensions;
 using TEAMModelOS.SDK.Helper.Common.ReflectorExtensions;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
+using DataType = Microsoft.Azure.Documents.DataType;
+using RequestOptions = Microsoft.Azure.Documents.Client.RequestOptions;
+using PartitionKey = Microsoft.Azure.Documents.PartitionKey;
 
 
 namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
 namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
 { /// <summary>
 { /// <summary>
@@ -61,12 +64,12 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 }
                 }
                 Database = options.Database;
                 Database = options.Database;
                 CollectionThroughput = options.CollectionThroughput;
                 CollectionThroughput = options.CollectionThroughput;
-                CosmosClient.CreateDatabaseIfNotExistsAsync(new Database { Id = Database });
+                CosmosClient.CreateDatabaseIfNotExistsAsync(new Microsoft.Azure.Documents.Database { Id = Database });
                 // _connectionString = options.ConnectionString;
                 // _connectionString = options.ConnectionString;
-               // CosmosSerializer
+                // CosmosSerializer
 
 
                 //获取数据库所有的表
                 //获取数据库所有的表
-                FeedResponse<DocumentCollection> collections = CosmosClient.ReadDocumentCollectionFeedAsync(UriFactory.CreateDatabaseUri(Database)).GetAwaiter().GetResult();
+                Microsoft.Azure.Documents.Client.FeedResponse<DocumentCollection> collections = CosmosClient.ReadDocumentCollectionFeedAsync(UriFactory.CreateDatabaseUri(Database)).GetAwaiter().GetResult();
                 foreach (IGrouping<string, DocumentCollection> group in collections.GroupBy(c => c.Id))
                 foreach (IGrouping<string, DocumentCollection> group in collections.GroupBy(c => c.Id))
                 {
                 {
                     DocumentCollectionDict.TryAdd(group.Key, group.First());
                     DocumentCollectionDict.TryAdd(group.Key, group.First());
@@ -109,7 +112,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                     else
                     else
                     {
                     {
                         DocumentCollection collectionDefinition = new DocumentCollection { Id = CollectionName };
                         DocumentCollection collectionDefinition = new DocumentCollection { Id = CollectionName };
-                        collectionDefinition.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
+                        collectionDefinition.IndexingPolicy = new Microsoft.Azure.Documents.IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
 
 
                         // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
                         // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
                         if (!string.IsNullOrEmpty(PartitionKey))
                         if (!string.IsNullOrEmpty(PartitionKey))
@@ -122,7 +125,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                             CollectionThroughput = RU;
                             CollectionThroughput = RU;
                         }
                         }
                         DocumentCollection DocumentCollection = CosmosClient.CreateDocumentCollectionIfNotExistsAsync(
                         DocumentCollection DocumentCollection = CosmosClient.CreateDocumentCollectionIfNotExistsAsync(
-                            UriFactory.CreateDatabaseUri(Database), collectionDefinition, new RequestOptions { OfferThroughput = CollectionThroughput }).GetAwaiter().GetResult();
+                            UriFactory.CreateDatabaseUri(Database), collectionDefinition, new Microsoft.Azure.Documents.Client.RequestOptions { OfferThroughput = CollectionThroughput }).GetAwaiter().GetResult();
                         DocumentCollectionDict.TryAdd(CollectionName, DocumentCollection);
                         DocumentCollectionDict.TryAdd(CollectionName, DocumentCollection);
                     }
                     }
                 }
                 }
@@ -171,7 +174,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
             else
             else
             {
             {
                 DocumentCollection documentCollection = new DocumentCollection { Id = CollectionName };
                 DocumentCollection documentCollection = new DocumentCollection { Id = CollectionName };
-                documentCollection.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
+                documentCollection.IndexingPolicy = new Microsoft.Azure.Documents.IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 });
 
 
                 // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
                 // collectionDefinition.PartitionKey = new PartitionKeyDefinition {  Paths = new System.Collections.ObjectModel.Collection<string>() };
                 if (!string.IsNullOrEmpty(PartitionKey))
                 if (!string.IsNullOrEmpty(PartitionKey))
@@ -640,7 +643,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
             };
             };
         }
         }
 
 
-        public async Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, bool IsPk)
+        public async Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, bool IsPk=true)
         {
         {
             Type t = typeof(T);
             Type t = typeof(T);
             // List<T> objs = new List<T>();
             // List<T> objs = new List<T>();

+ 1 - 1
TEAMModelOS.SDK/Module/AzureCosmosDB/Interfaces/IAzureCosmosDBRepository.cs

@@ -20,7 +20,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces
         Task<List<T>> FindSQL<T>(string sql, bool isPK);
         Task<List<T>> FindSQL<T>(string sql, bool isPK);
         Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault);
         Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault);
         Task<List<T>> FindByParams<T>(Dictionary<string, object> dict);
         Task<List<T>> FindByParams<T>(Dictionary<string, object> dict);
-        Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, bool isPK);
+        Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, bool isPK=true);
         Task<List<T>> SaveAll<T>(List<T> enyites);
         Task<List<T>> SaveAll<T>(List<T> enyites);
         Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null);
         Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null);
         Task<List<T>> DeleteAll<T>(Dictionary<string, object> dict);
         Task<List<T>> DeleteAll<T>(Dictionary<string, object> dict);

+ 0 - 2
TEAMModelOS.SDK/Module/AzureTable/Configuration/AzureTableOptions.cs

@@ -7,8 +7,6 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
     public class AzureTableOptions
     public class AzureTableOptions
     {
     {
         public string ConnectionString { get; set; } 
         public string ConnectionString { get; set; } 
-        public string AzureTableDialect { get; set; } 
-        public string DialectKey { get; set; } 
         /// <summary>
         /// <summary>
         /// 
         /// 
         /// </summary>
         /// </summary>

+ 1 - 2
TEAMModelOS.SDK/Module/AzureTable/Configuration/HaBookTableContinuationToken.cs

@@ -1,6 +1,5 @@
 
 
-using Microsoft.WindowsAzure.Storage;
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System;
 using System;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Extension.DataResult.PageToken;
 using TEAMModelOS.SDK.Extension.DataResult.PageToken;

+ 1 - 2
TEAMModelOS.SDK/Module/AzureTable/Configuration/TableClientSingleton.cs

@@ -1,5 +1,4 @@
-using Microsoft.WindowsAzure.Storage;
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 
 
 namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
 namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
 {
 {

Datei-Diff unterdrückt, da er zu groß ist
+ 120 - 74
TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs


+ 1 - 1
TEAMModelOS.SDK/Module/AzureTable/Interfaces/IAzureTableDBRepository.cs

@@ -1,8 +1,8 @@
 using TEAMModelOS.SDK.Module.AzureTable.Configuration;
 using TEAMModelOS.SDK.Module.AzureTable.Configuration;
 using TEAMModelOS.SDK.Extension.DataResult.PageToken;
 using TEAMModelOS.SDK.Extension.DataResult.PageToken;
-using Microsoft.WindowsAzure.Storage.Table;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using Microsoft.Azure.Cosmos.Table;
 
 
 namespace TEAMModelOS.SDK.Module.AzureTable.Interfaces
 namespace TEAMModelOS.SDK.Module.AzureTable.Interfaces
 {
 {

+ 2 - 0
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -24,7 +24,9 @@
     <PackageReference Include="System.Drawing.Common" Version="4.7.0" />
     <PackageReference Include="System.Drawing.Common" Version="4.7.0" />
     <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
     <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
     <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
     <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
+  <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
     <PackageReference Include="XC.Framework.Security.RSAUtil" Version="1.0.1" />
     <PackageReference Include="XC.Framework.Security.RSAUtil" Version="1.0.1" />
+    <PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="2.0.0-preview" />
   </ItemGroup>
   </ItemGroup>
 
 
 </Project>
 </Project>

+ 1 - 1
TEAMModelOS.Service/Models/Core/LoginInfo.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
 namespace TEAMModelOS.Service.Models.Core
 namespace TEAMModelOS.Service.Models.Core

+ 1 - 1
TEAMModelOS.Service/Models/Core/ResourceReference.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/KnowledgeBlock.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/KnowledgeBlockPoint.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/KnowledgePoint.cs

@@ -1,4 +1,4 @@
-using Microsoft.WindowsAzure.Storage.Table;
+using Microsoft.Azure.Cosmos.Table;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 

+ 1 - 1
TEAMModelOS/Controllers/Core/StudentController.cs

@@ -77,7 +77,7 @@ namespace TEAMModelOS.Controllers.Syllabus
             List<Student> students = new List<Student>();
             List<Student> students = new List<Student>();
             foreach (string key in dictInfo.Keys)
             foreach (string key in dictInfo.Keys)
             {
             {
-                List<Classroom> classrooms = await azureCosmosDBRepository.FindByParams<Classroom>(new Dictionary<string, object> { { "classroomCode", key } });
+                List<Classroom> classrooms = await azureCosmosDBRepository.FindByDict<Classroom>(new Dictionary<string, object> { { "classroomCode", key } } ,true);
                 if (classrooms.IsNotEmpty())
                 if (classrooms.IsNotEmpty())
                 {
                 {
                     long createDate = DateTimeOffset.UtcNow.Ticks;
                     long createDate = DateTimeOffset.UtcNow.Ticks;

+ 2 - 2
TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs

@@ -334,7 +334,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         {
         {
             Type t = typeof(T);
             Type t = typeof(T);
             string message = "";
             string message = "";
-            List<T> schoolBlocks = await _cosmos.FindByParams<T>(new Dictionary<string, object> {
+            List<T> schoolBlocks = await _cosmos.FindByDict<T>(new Dictionary<string, object> {
                 { "id", t.GetProperty("id").GetValue(schoolBlock) }
                 { "id", t.GetProperty("id").GetValue(schoolBlock) }
             });
             });
             if (schoolBlocks.IsNotEmpty())
             if (schoolBlocks.IsNotEmpty())
@@ -394,7 +394,7 @@ namespace TEAMModelOS.Controllers.Syllabus
 
 
         private async Task Delete<T>(JosnRPCRequest<Dictionary<string, object>> request, JsonRPCResponseBuilder builder)
         private async Task Delete<T>(JosnRPCRequest<Dictionary<string, object>> request, JsonRPCResponseBuilder builder)
         {
         {
-            List<T> schoolBlocks = await _cosmos.FindByParams<T>(request.@params);
+            List<T> schoolBlocks = await _cosmos.FindByDict<T>(request.@params,true);
             if (schoolBlocks.IsNotEmpty())
             if (schoolBlocks.IsNotEmpty())
             {
             {
                 schoolBlocks.ForEach(x => { _cosmos.DeleteAsync<T>(x); });
                 schoolBlocks.ForEach(x => { _cosmos.DeleteAsync<T>(x); });

+ 2 - 2
TEAMModelOS/Controllers/Syllabus/ResourceController.cs

@@ -80,7 +80,7 @@ namespace TEAMModelOS.Controllers.Syllabus
             if (request.@params != null)
             if (request.@params != null)
             {
             {
                 List<SyllabusResource> data = new List<SyllabusResource>();
                 List<SyllabusResource> data = new List<SyllabusResource>();
-                data = await _cosmos.FindByParams<SyllabusResource>(request.@params);
+                data = await _cosmos.FindByDict<SyllabusResource>(request.@params);
                 if (data.IsNotEmpty()) {
                 if (data.IsNotEmpty()) {
                 return builder.Data(data.OrderBy(m => m.createTime)).Extend(new Dictionary<string, object> { { "count", data.Count } }).build();
                 return builder.Data(data.OrderBy(m => m.createTime)).Extend(new Dictionary<string, object> { { "count", data.Count } }).build();
 
 
@@ -107,7 +107,7 @@ namespace TEAMModelOS.Controllers.Syllabus
 
 
         private async Task Delete<T>(JosnRPCRequest<Dictionary<string, object>> request, JsonRPCResponseBuilder builder)
         private async Task Delete<T>(JosnRPCRequest<Dictionary<string, object>> request, JsonRPCResponseBuilder builder)
         {
         {
-            List<T> schoolBlocks = await _cosmos.FindByParams<T>(request.@params);
+            List<T> schoolBlocks = await _cosmos.FindByDict<T>(request.@params,true);
             Type t = typeof(T);
             Type t = typeof(T);
             if (schoolBlocks.IsNotEmpty())
             if (schoolBlocks.IsNotEmpty())
             {
             {

+ 1 - 1
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -149,7 +149,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
         public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SyllabusNode> data =await azureCosmosDBRepository.FindByParams<SyllabusNode>(request.@params);
+            List<SyllabusNode> data =await azureCosmosDBRepository.FindByDict<SyllabusNode>(request.@params);
 
 
             if (request.@params.TryGetValue("id", out object id))
             if (request.@params.TryGetValue("id", out object id))
             {
             {

+ 1 - 1
TEAMModelOS/Controllers/Syllabus/VolumeController.cs

@@ -170,7 +170,7 @@ namespace TEAMModelOS.Controllers.Syllabus
             List<Volume> volumes ;
             List<Volume> volumes ;
             if (request.@params.TryGetValue("schoolCode", out _))
             if (request.@params.TryGetValue("schoolCode", out _))
             {
             {
-                volumes = await azureCosmosDBRepository.FindByParams<Volume>(request.@params);
+                volumes = await azureCosmosDBRepository.FindByDict<Volume>(request.@params,true);
             }
             }
             else
             else
             {
             {

+ 6 - 2
TEAMModelOS/Startup.cs

@@ -23,6 +23,8 @@ using TEAMModelOS.SDK.Extension.JwtAuth;
 using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
 using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Configuration;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Configuration;
 using TEAMModelOS.SDK.Module.AzureTable.Configuration;
 using TEAMModelOS.SDK.Module.AzureTable.Configuration;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using VueCliMiddleware;
 using VueCliMiddleware;
 
 
 namespace TEAMModelOS
 namespace TEAMModelOS
@@ -102,8 +104,10 @@ namespace TEAMModelOS
                 x.MultipartBodyLengthLimit = long.MaxValue; // In case of multipart
                 x.MultipartBodyLengthLimit = long.MaxValue; // In case of multipart
                 x.MultipartHeadersLengthLimit = int.MaxValue;
                 x.MultipartHeadersLengthLimit = int.MaxValue;
             });
             });
+
+
             // TableÅäÖÃ
             // TableÅäÖÃ
-            services.AddAzureTableStorage().AddConnection(Configuration.GetSection("Azure:Table").Get<AzureTableOptions>());
+            services.AddScoped<IAzureTableDBRepository, AzureTableDBRepository>();
             //ʹÓÃBlobÅäÖÃ
             //ʹÓÃBlobÅäÖÃ
             services.AddAzureBlobStorage().AddConnection(Configuration.GetSection("Azure:Blob").Get<AzureBlobOptions>());
             services.AddAzureBlobStorage().AddConnection(Configuration.GetSection("Azure:Blob").Get<AzureBlobOptions>());
             //ʹÓÃCosmosDB
             //ʹÓÃCosmosDB
@@ -118,7 +122,7 @@ namespace TEAMModelOS
             services.Scan(scan => scan.FromApplicationDependencies()
             services.Scan(scan => scan.FromApplicationDependencies()
                .AddClasses(classes => classes.AssignableTo<IBusinessService>())
                .AddClasses(classes => classes.AssignableTo<IBusinessService>())
                    .AsImplementedInterfaces()
                    .AsImplementedInterfaces()
-                   .WithSingletonLifetime());
+                   .WithScopedLifetime());
         }
         }
      
      
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.