Kaynağa Gözat

Function 优化

zhouj1203@hotmail.com 4 yıl önce
ebeveyn
işleme
072186c2f1

+ 65 - 49
TEAMModelFunction/MonitorCosmosDB.cs

@@ -19,12 +19,14 @@ namespace TEAMModelFunction
         private readonly IHttpClientFactory _clientFactory;
         private readonly AzureCosmosFactory _azureCosmos;
         private readonly AzureServiceBusFactory _serviceBus;
+        private readonly AzureStorageFactory _azureStorage;
 
-        public MonitorCosmosDB(IHttpClientFactory clientFactory, AzureCosmosFactory azureCosmos,AzureServiceBusFactory azureServiceBus)
+        public MonitorCosmosDB(IHttpClientFactory clientFactory, AzureCosmosFactory azureCosmos,AzureServiceBusFactory azureServiceBus, AzureStorageFactory azureStorage)
         {
             _clientFactory = clientFactory;
             _azureCosmos = azureCosmos;
             _serviceBus = azureServiceBus;
+            _azureStorage = azureStorage;
         }
 
         [FunctionName("ActiveChange")]
@@ -64,25 +66,28 @@ namespace TEAMModelFunction
                         }
                         var message = new ServiceBusMessage(new { id = input[0].Id, name = "Exam", code = code }.ToJsonString());
                         message.Properties.Add("name", "Exam");
-                        ChangeRecord record = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{info.progress}"));
+                        List<ChangeRecord> records = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input[0].Id }, { "PartitionKey", info.progress } });
+                        //ChangeRecord record = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{info.progress}"));
                         switch (info.progress) {
                             case "pending":
-                                if (record != null)
+                                if (records.Count> 0)
                                 {
+                                    await _serviceBus.GetServiceBusClient().cancelMessage("active - task", records[0].sequenceNumber);
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                    record.sequenceNumber = start;
-                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
+                                    records[0].sequenceNumber = start;
+                                    await _azureStorage.SaveOrUpdate<ChangeRecord>(records[0]);
+                                    //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
                                 }
                                 else {
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(stime));
                                     ChangeRecord changeRecord = new ChangeRecord
                                     {
-                                        id = input[0].Id,
-                                        code = "pending",
-                                        pk = "ChangeRecord",
+                                        RowKey = input[0].Id,
+                                        PartitionKey = "pending",
                                         sequenceNumber = start
                                     };
-                                    await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                    await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                    //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                 }                                
                                 break;
                             case "going":
@@ -127,23 +132,25 @@ namespace TEAMModelFunction
 
                                         }
                                     }
-                                    if (record != null)
+                                    if (records.Count > 0)
                                     {
-                                        long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                        record.sequenceNumber = start;
-                                        await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
+                                        long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(etime));
+                                        await _serviceBus.GetServiceBusClient().cancelMessage("active - task", records[0].sequenceNumber);
+                                        records[0].sequenceNumber = end;
+                                        await _azureStorage.SaveOrUpdate<ChangeRecord>(records[0]);
+                                        //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
                                     }
                                     else
                                     {
-                                        long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(etime));
+                                        long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", message, DateTimeOffset.FromUnixTimeMilliseconds(etime));
                                         ChangeRecord changeRecord = new ChangeRecord
                                         {
-                                            id = input[0].Id,
-                                            code = "going",
-                                            pk = "ChangeRecord",
-                                            sequenceNumber = start
+                                            RowKey = input[0].Id,
+                                            PartitionKey = "going",
+                                            sequenceNumber = end
                                         };
-                                        await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                        await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                        //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                     }
                                 }
                                 break;
@@ -211,46 +218,51 @@ namespace TEAMModelFunction
                         Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(input[0].Id, new Azure.Cosmos.PartitionKey($"{code}"));
                         var messageVote = new ServiceBusMessage(new { id = input[0].Id, name = "Vote", code = code }.ToJsonString());
                         messageVote.Properties.Add("name", "Vote");
-                        ChangeRecord voteRecord = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{vote.progress}"));
+                        List<ChangeRecord> voteRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input[0].Id }, { "PartitionKey", vote.progress } });
+                        //ChangeRecord voteRecord = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{vote.progress}"));
                         switch (vote.progress) {
                             case "pending":
-                                if (voteRecord != null)
+                                if (voteRecords.Count > 0)
                                 {
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                    voteRecord.sequenceNumber = start;
-                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(voteRecord, voteRecord.id, new Azure.Cosmos.PartitionKey($"{voteRecord.code}"));
+                                    await _serviceBus.GetServiceBusClient().cancelMessage("active - task", voteRecords[0].sequenceNumber);
+                                    voteRecords[0].sequenceNumber = start;
+                                    await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
+                                    //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(voteRecord, voteRecord.id, new Azure.Cosmos.PartitionKey($"{voteRecord.code}"));
                                 }
                                 else
                                 {
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(stime));
                                     ChangeRecord changeRecord = new ChangeRecord
                                     {
-                                        id = input[0].Id,
-                                        code = "pending",
-                                        pk = "ChangeRecord",
+                                        RowKey = input[0].Id,
+                                        PartitionKey = "pending",
                                         sequenceNumber = start
                                     };
-                                    await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                    await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                    //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                 }
                                 break;
                             case "going":
-                                if (voteRecord != null)
+                                if (voteRecords.Count > 0)
                                 {
                                     long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                    voteRecord.sequenceNumber = end;
-                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(voteRecord, voteRecord.id, new Azure.Cosmos.PartitionKey($"{voteRecord.code}"));
+                                    await _serviceBus.GetServiceBusClient().cancelMessage("active - task", voteRecords[0].sequenceNumber);
+                                    voteRecords[0].sequenceNumber = end;
+                                    await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
+                                    //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(voteRecord, voteRecord.id, new Azure.Cosmos.PartitionKey($"{voteRecord.code}"));
                                 }
                                 else
                                 {
                                     long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(etime));
                                     ChangeRecord changeRecord = new ChangeRecord
                                     {
-                                        id = input[0].Id,
-                                        code = "going",
-                                        pk = "ChangeRecord",
+                                        RowKey = input[0].Id,
+                                        PartitionKey = "going",
                                         sequenceNumber = end
                                     };
-                                    await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                    await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                    //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                 }
                                 break;
                         }
@@ -259,47 +271,51 @@ namespace TEAMModelFunction
                         Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(input[0].Id, new Azure.Cosmos.PartitionKey($"{code}"));
                         var messageSurvey = new ServiceBusMessage(new { id = input[0].Id, name = "Survey", code = code }.ToJsonString());
                         messageSurvey.Properties.Add("name", "Survey");
-                        ChangeRecord surveyRecord = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{survey.progress}"));
+                        List<ChangeRecord> changeRecords =  await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input[0].Id },{"PartitionKey", survey.progress} });
+                        //ChangeRecord surveyRecord = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ChangeRecord>(input[0].Id, new Azure.Cosmos.PartitionKey($"{survey.progress}"));
                         switch (survey.progress)
                         {
                             case "pending":
-                                if (surveyRecord != null)
+                                if (changeRecords.Count > 0)
                                 {
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                    surveyRecord.sequenceNumber = start;
-                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(surveyRecord, surveyRecord.id, new Azure.Cosmos.PartitionKey($"{surveyRecord.code}"));
+                                    await _serviceBus.GetServiceBusClient().cancelMessage("active - task", changeRecords[0].sequenceNumber);
+                                    changeRecords[0].sequenceNumber = start;
+                                    await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
+                                    //await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(surveyRecord, surveyRecord.id, new Azure.Cosmos.PartitionKey($"{surveyRecord.code}"));
                                 }
                                 else
                                 {
                                     long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(stime));
                                     ChangeRecord changeRecord = new ChangeRecord
                                     {
-                                        id = input[0].Id,
-                                        code = "pending",
-                                        pk = "ChangeRecord",
+                                        RowKey = input[0].Id,
+                                        PartitionKey = "pending",
                                         sequenceNumber = start
                                     };
-                                    await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                    await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                    //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                 }
                                 break;
                             case "going":
-                                if (surveyRecord != null)
+                                if (changeRecords.Count > 0)
                                 {
                                     long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                    surveyRecord.sequenceNumber = end;
-                                    await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(surveyRecord, surveyRecord.id, new Azure.Cosmos.PartitionKey($"{surveyRecord.code}"));
+                                    await _serviceBus.GetServiceBusClient().cancelMessage("active - task", changeRecords[0].sequenceNumber);
+                                    changeRecords[0].sequenceNumber = end;
+                                    await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
                                 }
                                 else
                                 {
                                     long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(etime));
                                     ChangeRecord changeRecord = new ChangeRecord
                                     {
-                                        id = input[0].Id,
-                                        code = "going",
-                                        pk = "ChangeRecord",
+                                        RowKey = input[0].Id,
+                                        PartitionKey = "going",
                                         sequenceNumber = end
                                     };
-                                    await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
+                                    await _azureStorage.Save<ChangeRecord>(changeRecord);
+                                    //await client.GetContainer("TEAMModelOS", "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
                                 }
                                 break;
                         }

+ 25 - 11
TEAMModelFunction/ServiceBusTopic.cs

@@ -20,18 +20,22 @@ namespace TEAMModelFunction
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
         }
-        [FunctionName("ServiceBusTopic")]
+        [FunctionName("exam")]
         public async Task ExamBus([ServiceBusTrigger("active-task", "exam", Connection = "AzureServiceBusConnectionString")] string mySbMsg)
         {
             try
             {
-                Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
+                var json = JsonDocument.Parse(mySbMsg);                
+                json.RootElement.TryGetProperty("id", out JsonElement id);
+                json.RootElement.TryGetProperty("name", out JsonElement name);
+                json.RootElement.TryGetProperty("code", out JsonElement code);
+                //Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
                 var client = _azureCosmos.GetCosmosClient();
-                keyValuePairs.TryGetValue("id", out object id);
+/*                keyValuePairs.TryGetValue("id", out object id);
                 keyValuePairs.TryGetValue("name", out object name);
-                keyValuePairs.TryGetValue("code", out object code);
+                keyValuePairs.TryGetValue("code", out object code);*/
                 //keyValuePairs.TryGetValue("status", out object progress);
-                if (name.ToString().Equals("ExamInfo", StringComparison.OrdinalIgnoreCase))
+                if (name.ToString().Equals("Exam", StringComparison.OrdinalIgnoreCase))
                 {
                     ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
                     if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(exam.startTime) > 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(exam.endTime) < 0)
@@ -49,14 +53,19 @@ namespace TEAMModelFunction
             }
                               
         }
+        [FunctionName("vote")]
         public async Task VoteBus([ServiceBusTrigger("active-task", "vote", Connection = "AzureServiceBusConnectionString")] string mySbMsg)
         {
             try {
-                Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
+                var jsonMsg = JsonDocument.Parse(mySbMsg);
+                jsonMsg.RootElement.TryGetProperty("id", out JsonElement id);
+                jsonMsg.RootElement.TryGetProperty("name", out JsonElement name);
+                jsonMsg.RootElement.TryGetProperty("code", out JsonElement code);
+                //Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
                 var client = _azureCosmos.GetCosmosClient();
-                keyValuePairs.TryGetValue("id", out object id);
+                /*keyValuePairs.TryGetValue("id", out object id);
                 keyValuePairs.TryGetValue("name", out object name);
-                keyValuePairs.TryGetValue("code", out object code);
+                keyValuePairs.TryGetValue("code", out object code);*/
                 //keyValuePairs.TryGetValue("status", out object progress);
                 if (name.ToString().Equals("Vote", StringComparison.OrdinalIgnoreCase))
                 {
@@ -82,14 +91,19 @@ namespace TEAMModelFunction
             }
                          
         }
+        [FunctionName("survey")]
         public async Task SurveyBus([ServiceBusTrigger("active-task", "survey", Connection = "AzureServiceBusConnectionString")] string mySbMsg)
         {
             try {
-                Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
+                var jsonMsg = JsonDocument.Parse(mySbMsg);
+                jsonMsg.RootElement.TryGetProperty("id", out JsonElement id);
+                jsonMsg.RootElement.TryGetProperty("name", out JsonElement name);
+                jsonMsg.RootElement.TryGetProperty("code", out JsonElement code);
+                //Dictionary<string, object> keyValuePairs = mySbMsg.ToObject<Dictionary<string, object>>();
                 var client = _azureCosmos.GetCosmosClient();
-                keyValuePairs.TryGetValue("id", out object id);
+                /*keyValuePairs.TryGetValue("id", out object id);
                 keyValuePairs.TryGetValue("name", out object name);
-                keyValuePairs.TryGetValue("code", out object code);
+                keyValuePairs.TryGetValue("code", out object code);*/
                 //keyValuePairs.TryGetValue("status", out object progress);
                 if (name.ToString().Equals("Survey", StringComparison.OrdinalIgnoreCase))
                 {

+ 6 - 1
TEAMModelFunction/Startup.cs

@@ -16,9 +16,11 @@ namespace TEAMModelFunction
     { 
         public override void Configure(IFunctionsHostBuilder builder)
         {
-            var ConnectionString = System.Environment.GetEnvironmentVariable("CosmosConnection");
+            var ConnectionString = System.Environment.GetEnvironmentVariable("AzureServiceCosmosConnectionString");
             var ScanModel = System.Environment.GetEnvironmentVariable("ScanModel");
             var Database = System.Environment.GetEnvironmentVariable("Database");
+            var ServiceBusConnectionString = System.Environment.GetEnvironmentVariable("AzureServiceBusConnectionString");
+            var AzureStarageConnectionString = System.Environment.GetEnvironmentVariable("AzureStarageConnectionString");
             builder.Services.AddHttpClient();
             builder.Services.AddAzureCosmos(new AzureCosmosFactoryOptions 
             { 
@@ -27,6 +29,9 @@ namespace TEAMModelFunction
                 ScanModel= ScanModel.Split(","),
                 Database = Database.Split(","),
             });
+            builder.Services.AddAzureServiceBus(ServiceBusConnectionString);
+            builder.Services.AddHttpClient<DingDing>();
+            builder.Services.AddAzureStorage(AzureStarageConnectionString);
         }
     }
 }

+ 0 - 3
TEAMModelFunction/TEAMModelFunction.csproj

@@ -17,9 +17,6 @@
   <ItemGroup>
     <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
   </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\TEAMModelOS\TEAMModelOS.csproj" />
-  </ItemGroup>
   <ItemGroup>
     <None Update="host.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 3 - 2
TEAMModelFunction/local.settings.json

@@ -3,8 +3,9 @@
   "Values": {
     "AzureWebJobsStorage": "UseDevelopmentStorage=true",
     "FUNCTIONS_WORKER_RUNTIME": "dotnet",
-    "ConnectionBusName": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
-    "CosmosConnection": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
+    "AzureServiceBusConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
+    "AzureServiceCosmosConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
+    "AzureStarageConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn",
     "ScanModel": "TEAMModelOS",
     "Database": "TEAMModelOS"
   }  

+ 5 - 5
TEAMModelFunction/model/ChangeRecord.cs

@@ -1,15 +1,15 @@
+using Microsoft.Azure.Cosmos.Table;
 using System;
 using System.Collections.Generic;
 using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.DI;
 
 namespace TEAMModelFunction.model
 {
-    public class ChangeRecord { 
-
-        public string pk { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
-        public string id { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
-        public string code { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+    [TableName(Name = "ChangeRecord")]
+    public class ChangeRecord : TableEntity
+    { 
         public long sequenceNumber { get; set; }
     }
 }

+ 0 - 1
TEAMModelFunction/model/Survey.cs

@@ -3,7 +3,6 @@ using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Text;
-using TEAMModelOS.Models.CommonInfo;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.DI;