diff --git a/Projects/DLL/SystemX.Core.dll b/Projects/DLL/SystemX.Core.dll index 63303a1..7161570 100644 Binary files a/Projects/DLL/SystemX.Core.dll and b/Projects/DLL/SystemX.Core.dll differ diff --git a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql b/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql index 07c385a..481d1a1 100644 --- a/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql +++ b/Projects/HubX/DBPatch/sqlScripts/HubX.DB_Create.sql @@ -248,7 +248,6 @@ PRINT N'테이블 [dbo].[tStorage]을(를) 만드는 중...'; GO CREATE TABLE [dbo].[tStorage] ( - [cHuid] BIGINT IDENTITY (1, 1) NOT NULL, [cIdentity] NVARCHAR (200) NOT NULL, [cDateTime] DATETIME2 (7) NOT NULL, [cData1] NVARCHAR (4000) NULL, @@ -256,7 +255,7 @@ CREATE TABLE [dbo].[tStorage] ( [cData3] NVARCHAR (4000) NULL, [cData4] NVARCHAR (4000) NULL, [cData5] NVARCHAR (4000) NULL, - PRIMARY KEY CLUSTERED ([cHuid] ASC) + PRIMARY KEY CLUSTERED ([cIdentity] ASC) ); diff --git a/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac b/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac index b33f33f..542d3e3 100644 Binary files a/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac and b/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac differ diff --git a/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql b/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql index a77f058..c813a44 100644 --- a/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql +++ b/Projects/HubX/HubX.DB/dbo/Tables/tStorage.sql @@ -1,7 +1,6 @@ CREATE TABLE [dbo].[tStorage] -( - [cHuid] BIGINT NOT NULL PRIMARY KEY IDENTITY(1,1), - [cIdentity] NVARCHAR(200) NOT NULL, +( + [cIdentity] NVARCHAR(200) NOT NULL PRIMARY KEY, [cDateTime] DATETIME2 NOT NULL, [cData1] NVARCHAR(4000), [cData2] NVARCHAR(4000), diff --git a/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs b/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs index efae9f5..a125fdb 100644 --- a/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs +++ b/Projects/HubX/HubX.Library.DB/DB/HubX/Context/HubXContext.cs @@ -25,11 +25,13 @@ public partial class HubXContext : DbContext { modelBuilder.Entity(entity => { - entity.HasKey(e => e.CHuid).HasName("PK__tStorage__346C9EFC86D3DC51"); + entity.HasKey(e => e.CIdentity).HasName("PK__tStorage__3EBC650D3753A7B8"); entity.ToTable("tStorage"); - entity.Property(e => e.CHuid).HasColumnName("cHuid"); + entity.Property(e => e.CIdentity) + .HasMaxLength(200) + .HasColumnName("cIdentity"); entity.Property(e => e.CData1) .HasMaxLength(4000) .HasColumnName("cData1"); @@ -46,9 +48,6 @@ public partial class HubXContext : DbContext .HasMaxLength(4000) .HasColumnName("cData5"); entity.Property(e => e.CDateTime).HasColumnName("cDateTime"); - entity.Property(e => e.CIdentity) - .HasMaxLength(200) - .HasColumnName("cIdentity"); }); OnModelCreatingPartial(modelBuilder); diff --git a/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs b/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs index 2b90c0c..7721130 100644 --- a/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs +++ b/Projects/HubX/HubX.Library.DB/DB/HubX/Tables/TStorage.cs @@ -5,8 +5,6 @@ namespace DB.HubXDB; public partial class TStorage { - public long CHuid { get; set; } - public string CIdentity { get; set; } = null!; public DateTime CDateTime { get; set; } diff --git a/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs b/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs index 61bd8f2..0217858 100644 --- a/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs +++ b/Projects/HubX/HubX.Server/Services/UniqueKeyService.cs @@ -21,7 +21,7 @@ namespace HubX.Server.Services _scopeFactory = scopeFactory; } - public async Task Request_InsertUniqueKey(Request_InsertUniqueKey request) + public async Task Request_InsertUniqueKey(Request_InsertUniqueKey request, string guid = "") { Response_InsertUniqueKy response = new Response_InsertUniqueKy(); @@ -35,10 +35,10 @@ namespace HubX.Server.Services var context = scope.ServiceProvider.GetRequiredService(); if (context != null) { - var data = context.TStorages.AsNoTracking().Where(x => x.CIdentity == request.Identity).ToList(); + var data = await context.TStorages.AsNoTracking().Where(x => x.CIdentity == request.Identity).ToListAsync(); if (data?.Count() > 0) { - Log4net.WriteLine($"Exist Unique Key", LogType.Error); + Log4net.WriteLine($"Exist Unique Key::{guid}", LogType.Error); response.Result = "Exist Unique Key"; } else @@ -64,7 +64,7 @@ namespace HubX.Server.Services if (transactionResult == false) { response.Result = EnumResult.Failed.ToString(); - Log4net.WriteLine($"Transaction Error", LogType.Error); + Log4net.WriteLine($"Transaction Error::{guid}", LogType.Error); } else { @@ -78,7 +78,7 @@ namespace HubX.Server.Services return response; } - public async Task Request_SelectUniqueKey(Request_SelectUniqueKey request) + public async Task Request_SelectUniqueKey(Request_SelectUniqueKey request, string guid = "") { Response_SelectUniqueKy response = new Response_SelectUniqueKy(); @@ -94,7 +94,7 @@ namespace HubX.Server.Services { using (var transaction = await context.CreateTransactionAsync(IsolationLevel.ReadUncommitted)) { - var data = context.TStorages.AsNoTracking().ToList().First(x => x.CIdentity == request.Identity); + var data = await context.TStorages.AsNoTracking().FirstOrDefaultAsync(x => x.CIdentity == request.Identity); await context.CloseTransactionAsync(transaction); if (data != null) { @@ -108,7 +108,7 @@ namespace HubX.Server.Services } catch (Exception e) { - Log4net.WriteLine($"Select Unique Key Transaction Error", LogType.Error); + Log4net.WriteLine($"Select Unique Key Transaction Error::{guid}", LogType.Error); Log4net.WriteLine(e); } } @@ -118,7 +118,7 @@ namespace HubX.Server.Services return response; } - public async Task Request_UpdateUniqueKey(Request_UpdateUniqueKey request) + public async Task Request_UpdateUniqueKey(Request_UpdateUniqueKey request, string guid = "") { Response_UpdateUniqueKy response = new Response_UpdateUniqueKy(); @@ -133,7 +133,7 @@ namespace HubX.Server.Services var context = scope.ServiceProvider.GetRequiredService(); if (context != null) { - var selected = context.TStorages.First(x => x.CIdentity == request.Identity); + var selected = await context.TStorages.FirstOrDefaultAsync(x => x.CIdentity == request.Identity); if (selected != null) { selected.CData1 = request.Data1; @@ -154,7 +154,7 @@ namespace HubX.Server.Services if (transactionResult == false) { response.Result = EnumResult.Failed.ToString(); - Log4net.WriteLine($"Transaction Error", LogType.Error); + Log4net.WriteLine($"Transaction Error::{guid}", LogType.Error); } else { diff --git a/Projects/SystemX.Core/SystemX.Core/Communication/Http.cs b/Projects/SystemX.Core/SystemX.Core/Communication/Http.cs index 33cbbf2..2657017 100644 --- a/Projects/SystemX.Core/SystemX.Core/Communication/Http.cs +++ b/Projects/SystemX.Core/SystemX.Core/Communication/Http.cs @@ -21,16 +21,16 @@ namespace SystemX.Core.Communication using (HttpClient httpClient = new HttpClient(GetClientHandler())) { + var timeOutSec = SetTimeout(timeOutSeconds); + httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); + httpClient.BaseAddress = new Uri($"{url}"); + int retry = 0; while (true) { await Task.Delay(1); try { - var timeOutSec = SetTimeout(timeOutSeconds); - httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); - httpClient.BaseAddress = new Uri($"{url}"); - Log4net.WriteLine($"[POST] Request({guid})::{url}{Environment.NewLine}{request?.ToJson()}", LogType.HTTP); DateTime requestTime = DateTime.Now;