diff --git a/console/YANLib.Benchmarks/YANLib.Benchmarks.csproj b/console/YANLib.Benchmarks/YANLib.Benchmarks.csproj
index cdd7522e..20a2b620 100644
--- a/console/YANLib.Benchmarks/YANLib.Benchmarks.csproj
+++ b/console/YANLib.Benchmarks/YANLib.Benchmarks.csproj
@@ -2,14 +2,14 @@
Exe
- net7.0
+ net6.0
enable
enable
preview
-
+
diff --git a/host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj b/host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj
index 584ad472..66eb85c9 100644
--- a/host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj
+++ b/host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
true
YANLib-4681b4fd-151f-4221-84a4-929d86723e4c
@@ -14,34 +14,34 @@
-
-
+
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/host/YANLib.HttpApi.Host/appsettings.Development.json b/host/YANLib.HttpApi.Host/appsettings.Development.json
index 6d297e0b..e1bdc16f 100644
--- a/host/YANLib.HttpApi.Host/appsettings.Development.json
+++ b/host/YANLib.HttpApi.Host/appsettings.Development.json
@@ -60,8 +60,8 @@
"Sample": "yanlib_sample_index_dev"
},
"Url": "http://192.168.1.8:9200/",
- "Username": "yanlib_index",
- "Password": "yanlibindex123"
+ "Username": "elastic",
+ "Password": "admin123"
},
"RemoteServices": {
"TestApi": {
@@ -113,7 +113,7 @@
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://192.168.1.8:9200",
- "connectionGlobalHeaders": "Authorization=Basic eWFubGliX2xvZ3M6eWFubGlibG9nczEyMw==",
+ "connectionGlobalHeaders": "Authorization=Basic ZWxhc3RpYzphZG1pbjEyMw==",
"indexFormat": "log-dev-yanlib-{0:yyyy.MM.dd}",
"autoRegisterTemplate": true,
"autoRegisterTemplateVersion": "ESv8"
diff --git a/host/YANLib.HttpApi.Host/appsettings.Production.json b/host/YANLib.HttpApi.Host/appsettings.Production.json
index d31d8b28..a24e6a24 100644
--- a/host/YANLib.HttpApi.Host/appsettings.Production.json
+++ b/host/YANLib.HttpApi.Host/appsettings.Production.json
@@ -60,8 +60,8 @@
"Sample": "yanlib_sample_index_prod"
},
"Url": "http://elasticsearch:9200/",
- "Username": "yanlib_index",
- "Password": "yanlibindex123"
+ "Username": "elastic",
+ "Password": "admin123"
},
"RemoteServices": {
"TestApi": {
@@ -113,7 +113,7 @@
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://elasticsearch:9200",
- "connectionGlobalHeaders": "Authorization=Basic eWFubGliX2xvZ3M6eWFubGlibG9nczEyMw==",
+ "connectionGlobalHeaders": "Authorization=Basic ZWxhc3RpYzphZG1pbjEyMw==",
"indexFormat": "log-prod-yanlib-{0:yyyy.MM.dd}",
"autoRegisterTemplate": true,
"autoRegisterTemplateVersion": "ESv8"
diff --git a/src/YANLib.Application.Contracts/Permissions/YANLibPermissionDefinitionProvider.cs b/src/YANLib.Application.Contracts/Permissions/YANLibPermissionDefinitionProvider.cs
index 5b828318..633d681e 100644
--- a/src/YANLib.Application.Contracts/Permissions/YANLibPermissionDefinitionProvider.cs
+++ b/src/YANLib.Application.Contracts/Permissions/YANLibPermissionDefinitionProvider.cs
@@ -7,12 +7,5 @@ namespace YANLib.Permissions;
public class YANLibPermissionDefinitionProvider : PermissionDefinitionProvider
{
- public override void Define(IPermissionDefinitionContext context)
- {
- var myGroup = context.AddGroup(YANLibPermissions.GroupName);
- //Define your own permissions here. Example:
- //myGroup.AddPermission(YANLibPermissions.MyPermission1, L("Permission:MyPermission1"));
- }
-
- private static LocalizableString L(string name) => Create(name);
+ public override void Define(IPermissionDefinitionContext context) => context.AddGroup(YANLibPermissions.GroupName);
}
diff --git a/src/YANLib.Application.Contracts/Permissions/YANLibPermissions.cs b/src/YANLib.Application.Contracts/Permissions/YANLibPermissions.cs
index 080a544e..52ae710b 100644
--- a/src/YANLib.Application.Contracts/Permissions/YANLibPermissions.cs
+++ b/src/YANLib.Application.Contracts/Permissions/YANLibPermissions.cs
@@ -3,7 +3,4 @@
public static class YANLibPermissions
{
public const string GroupName = "YANLib";
-
- //Add your own permission names. Example:
- //public const string MyPermission1 = GroupName + ".MyPermission1";
}
diff --git a/src/YANLib.Application.Contracts/Requests/CertificateRequest.cs b/src/YANLib.Application.Contracts/Requests/CertificateRequest.cs
index d7f0fbe2..6cc76e32 100644
--- a/src/YANLib.Application.Contracts/Requests/CertificateRequest.cs
+++ b/src/YANLib.Application.Contracts/Requests/CertificateRequest.cs
@@ -1,12 +1,17 @@
-namespace YANLib.Requests;
+using System.ComponentModel.DataAnnotations;
+
+namespace YANLib.Requests;
public sealed class CertificateRequest
{
- public required string Id { get; set; }
+ [Required]
+ public string Id { get; set; }
- public required string Name { get; set; }
+ [Required]
+ public string Name { get; set; }
public double? GPA { get; set; }
- public required string DeveloperId { get; set; }
+ [Required]
+ public string DeveloperId { get; set; }
}
diff --git a/src/YANLib.Application.Contracts/Requests/Developer/DeveloperCreateRequest.cs b/src/YANLib.Application.Contracts/Requests/Developer/DeveloperCreateRequest.cs
index d64e2a54..077f3fa4 100644
--- a/src/YANLib.Application.Contracts/Requests/Developer/DeveloperCreateRequest.cs
+++ b/src/YANLib.Application.Contracts/Requests/Developer/DeveloperCreateRequest.cs
@@ -1,22 +1,27 @@
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
namespace YANLib.Requests.Developer;
public sealed class DeveloperCreateRequest
{
- public required string Name { get; set; }
+ [Required]
+ public string Name { get; set; }
public string Phone { get; set; }
- public required string IdCard { get; set; }
+ [Required]
+ public string IdCard { get; set; }
- public required int DeveloperTypeCode { get; set; }
+ [Required]
+ public int DeveloperTypeCode { get; set; }
public List Certificates { get; set; }
public sealed class Certificate
{
- public required string Name { get; set; }
+ [Required]
+ public string Name { get; set; }
public double? GPA { get; set; }
}
diff --git a/src/YANLib.Application.Contracts/Requests/Developer/DeveloperUpdateRequest.cs b/src/YANLib.Application.Contracts/Requests/Developer/DeveloperUpdateRequest.cs
index ca18534a..f078de4a 100644
--- a/src/YANLib.Application.Contracts/Requests/Developer/DeveloperUpdateRequest.cs
+++ b/src/YANLib.Application.Contracts/Requests/Developer/DeveloperUpdateRequest.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
namespace YANLib.Requests.Developer;
@@ -14,7 +15,8 @@ public sealed class DeveloperUpdateRequest
public sealed class Certificate
{
- public required string Name { get; set; }
+ [Required]
+ public string Name { get; set; }
public double? GPA { get; set; }
}
diff --git a/src/YANLib.Application.Contracts/Requests/DeveloperType/DeveloperTypeCreateRequest.cs b/src/YANLib.Application.Contracts/Requests/DeveloperType/DeveloperTypeCreateRequest.cs
index 9e7dbbcf..c3773205 100644
--- a/src/YANLib.Application.Contracts/Requests/DeveloperType/DeveloperTypeCreateRequest.cs
+++ b/src/YANLib.Application.Contracts/Requests/DeveloperType/DeveloperTypeCreateRequest.cs
@@ -1,10 +1,14 @@
-namespace YANLib.Requests.DeveloperType;
+using System.ComponentModel.DataAnnotations;
+
+namespace YANLib.Requests.DeveloperType;
public sealed class DeveloperTypeCreateRequest
{
- public required int Code { get; set; }
+ [Required]
+ public int Code { get; set; }
- public required string Name { get; set; }
+ [Required]
+ public string Name { get; set; }
public bool IsActive { get; set; } = true;
}
diff --git a/src/YANLib.Application.Contracts/YANLib.Application.Contracts.csproj b/src/YANLib.Application.Contracts/YANLib.Application.Contracts.csproj
index be14430c..6ee1305f 100644
--- a/src/YANLib.Application.Contracts/YANLib.Application.Contracts.csproj
+++ b/src/YANLib.Application.Contracts/YANLib.Application.Contracts.csproj
@@ -3,15 +3,15 @@
- net7.0
+ net6.0
YANLib
preview
-
-
+
+
diff --git a/src/YANLib.Application.Redis/Services/Implements/DeveloperTypeRedisService.cs b/src/YANLib.Application.Redis/Services/Implements/DeveloperTypeRedisService.cs
index eac4964d..3a1246ce 100644
--- a/src/YANLib.Application.Redis/Services/Implements/DeveloperTypeRedisService.cs
+++ b/src/YANLib.Application.Redis/Services/Implements/DeveloperTypeRedisService.cs
@@ -42,6 +42,7 @@ public DeveloperTypeRedisService(ILogger logger, IRed
catch (Exception ex)
{
_logger.LogError(ex, "GetDeveloperTypeRedisService-Exception: {Group} - {Key}", group, key);
+
throw;
}
}
@@ -82,6 +83,7 @@ await WhenAll(keys.Select(async k =>
catch (Exception ex)
{
_logger.LogError(ex, "GetBulkDeveloperTypeRedisService-Exception: {Group} - {Keys}", group, string.Join(", ", keys));
+
throw;
}
}
@@ -122,6 +124,7 @@ await WhenAll((await _database.HashGetAllAsync(group.ToLowerInvariant())).Where(
catch (Exception ex)
{
_logger.LogError(ex, "GetAllDeveloperTypeRedisService-Exception: {Group}", group);
+
throw;
}
}
@@ -132,13 +135,14 @@ public async ValueTask Set(string group, string key, DeveloperTypeRedisDto
try
{
- return group.IsWhiteSpaceOrNull() || key.IsWhiteSpaceOrNull() || value is null
+ return group.IsWhiteSpaceOrNull() || key.IsWhiteSpaceOrNull() || value.IsNull()
? throw new BusinessException(BAD_REQUEST)
: await _database.HashSetAsync((RedisKey)group.ToLowerInvariant(), (RedisValue)key.ToLowerInvariant(), jsonVal);
}
catch (Exception ex)
{
_logger.LogError(ex, "SetDeveloperTypeRedisService-Exception: {Group} - {Key} - {Value}", group, key, jsonVal);
+
throw;
}
}
@@ -159,6 +163,7 @@ public async ValueTask SetBulk(string group, IDictionary Delete(string group, string key)
catch (Exception ex)
{
_logger.LogError(ex, "DeleteDeveloperTypeRedisService-Exception: {Group} - {Key}", group, key);
+
throw;
}
}
@@ -207,6 +213,7 @@ await WhenAll(keys.Where(k => k.IsNotWhiteSpaceAndNull()).Select(async k =>
catch (Exception ex)
{
_logger.LogError(ex, "DeleteBulkDeveloperTypeRedisService-Exception: {Group} - {Keys}", group, string.Join(", ", keys));
+
throw;
}
}
@@ -227,6 +234,7 @@ public async ValueTask DeleteAll(string group)
catch (Exception ex)
{
_logger.LogError(ex, "DeleteAllDeveloperTypeRedisService-Exception: {Group}", group);
+
throw;
}
}
@@ -237,7 +245,7 @@ public async ValueTask DeleteAll(string group)
{
var redisRslt = await GetGroupKeys(groupPreffix);
- if (redisRslt is not null)
+ if (redisRslt.IsNotNull())
{
var keys = (RedisKey[])redisRslt!;
var rslts = new Dictionary?>();
@@ -284,7 +292,7 @@ public async ValueTask DeleteGroup(string groupPreffix)
{
var redisRslt = await GetGroupKeys(groupPreffix);
- if (redisRslt is not null)
+ if (redisRslt.IsNotNull())
{
var keys = (RedisKey[])redisRslt!;
diff --git a/src/YANLib.Application.Redis/YANLib.Application.Redis.csproj b/src/YANLib.Application.Redis/YANLib.Application.Redis.csproj
index 80d97246..0a4acbb0 100644
--- a/src/YANLib.Application.Redis/YANLib.Application.Redis.csproj
+++ b/src/YANLib.Application.Redis/YANLib.Application.Redis.csproj
@@ -1,14 +1,14 @@
- net7.0
+ net6.0
enable
enable
preview
-
+
diff --git a/src/YANLib.Application/EsServices/DeveloperEsService.cs b/src/YANLib.Application/EsServices/DeveloperEsService.cs
index fac2b8c2..510d6bc9 100644
--- a/src/YANLib.Application/EsServices/DeveloperEsService.cs
+++ b/src/YANLib.Application/EsServices/DeveloperEsService.cs
@@ -31,6 +31,7 @@ public async ValueTask Get(string id)
catch (Exception ex)
{
_logger.LogError(ex, "GetDeveloperEsService-Exception: {Id}", id);
+
throw;
}
}
@@ -41,11 +42,12 @@ public async ValueTask Set(DeveloperIndex data)
try
{
- return await _elasticClient.IndexDocumentAsync(data) is not null;
+ return (await _elasticClient.IndexDocumentAsync(data)).IsNotNull();
}
catch (Exception ex)
{
_logger.LogError(ex, "SetDeveloperEsService-Exception: {Data}", data.Serialize());
+
throw;
}
}
@@ -69,11 +71,12 @@ public async ValueTask SetBulk(List datas)
_ = reqs.Index(x => x.Document(data).Index(index));
}
- return await _elasticClient.BulkAsync(reqs) is not null;
+ return (await _elasticClient.BulkAsync(reqs)).IsNotNull();
}
catch (Exception ex)
{
_logger.LogError(ex, "SetBulkDeveloperEsService-Exception: {Datas}", datas.Serialize());
+
throw;
}
}
@@ -89,6 +92,7 @@ public async ValueTask DeleteAll()
catch (Exception ex)
{
_logger.LogError(ex, "DeleteAllDeveloperEsService-Exception");
+
throw;
}
}
diff --git a/src/YANLib.Application/Services/CertificateService.cs b/src/YANLib.Application/Services/CertificateService.cs
index 84654d51..8589ca8b 100644
--- a/src/YANLib.Application/Services/CertificateService.cs
+++ b/src/YANLib.Application/Services/CertificateService.cs
@@ -20,11 +20,12 @@ public async ValueTask Create(CertificateRequest request)
{
try
{
- return await _repository.Create(ObjectMapper.Map(request)) is not null;
+ return (await _repository.Create(ObjectMapper.Map(request))).IsNotNull();
}
catch (Exception ex)
{
_logger.LogError(ex, "CreateCertificateService-Exception: {Request}", request.Serialize());
+
throw;
}
}
@@ -33,11 +34,12 @@ public async ValueTask Update(CertificateRequest request)
{
try
{
- return await _repository.Update(ObjectMapper.Map(request)) is not null;
+ return (await _repository.Update(ObjectMapper.Map(request))).IsNotNull();
}
catch (Exception ex)
{
_logger.LogError(ex, "UpdateCertificateService-Exception: {Request}", request.Serialize());
+
throw;
}
}
diff --git a/src/YANLib.Application/Services/DeveloperService.cs b/src/YANLib.Application/Services/DeveloperService.cs
index 918ef562..f4d0c2d6 100644
--- a/src/YANLib.Application/Services/DeveloperService.cs
+++ b/src/YANLib.Application/Services/DeveloperService.cs
@@ -33,8 +33,7 @@ public class DeveloperService(
ICertificateRepository certificateRepository,
IDeveloperEsService esService,
IDistributedEventBus distributedEventBus,
- ICapPublisher capPublisher
-) : YANLibAppService, IDeveloperService
+ ICapPublisher capPublisher) : YANLibAppService, IDeveloperService
{
private readonly ILogger _logger = logger;
private readonly IDeveloperRepository _repository = repository;
@@ -54,6 +53,7 @@ public async ValueTask GetByIdCard(string idCard)
catch (Exception ex)
{
_logger.LogError(ex, "GetByIdCardDeveloperService-Exception: {IdCard}", idCard);
+
throw;
}
}
@@ -62,7 +62,7 @@ public async ValueTask Create(DeveloperCreateRequest request)
{
try
{
- if (await _esService.Get(request.IdCard) is not null)
+ if ((await _esService.Get(request.IdCard)).IsNotNull())
{
throw new BusinessException(EXIST_ID_CARD).WithData("IdCard", request.IdCard);
}
@@ -74,7 +74,7 @@ public async ValueTask Create(DeveloperCreateRequest request)
var rslt = ObjectMapper.Map(await _repository.Create(ent));
- if (rslt is not null)
+ if (rslt.IsNotNull())
{
rslt.DeveloperType = await _developerTypeService.Get(ent.DeveloperTypeCode);
}
@@ -106,6 +106,7 @@ public async ValueTask Create(DeveloperCreateRequest request)
catch (Exception ex)
{
_logger.LogError(ex, "CreateDeveloperService-Exception: {Request}", request.Serialize());
+
throw;
}
}
@@ -126,7 +127,7 @@ public async ValueTask Adjust(string idCard, DeveloperUpdateR
var rslt = ObjectMapper.Map(await _repository.Adjust(ent));
- if (rslt is not null)
+ if (rslt.IsNotNull())
{
rslt.DeveloperType = await _developerTypeService.Get(ent.DeveloperTypeCode);
}
@@ -173,6 +174,7 @@ public async ValueTask Adjust(string idCard, DeveloperUpdateR
catch (Exception ex)
{
_logger.LogError(ex, "AdjustDeveloperService-Exception: {IdCard} - {DTO}", idCard, dto.Serialize());
+
throw;
}
}
@@ -186,6 +188,7 @@ public async ValueTask> GetByPhone(string phone)
catch (Exception ex)
{
_logger.LogError(ex, "GetByPhoneDeveloperService-Exception: {Phone}", phone);
+
throw;
}
}
@@ -199,6 +202,7 @@ public async ValueTask> SearchByPhone(string searchText)
catch (Exception ex)
{
_logger.LogError(ex, "SearchByPhoneDeveloperService-Exception: {SearchText}", searchText);
+
throw;
}
}
@@ -239,6 +243,7 @@ await WhenAll(mdls.Select(async x =>
catch (Exception ex)
{
_logger.LogError(ex, "SyncDbToEsDeveloperService-Exception");
+
throw;
}
}
diff --git a/src/YANLib.Application/Services/DeveloperTypeService.cs b/src/YANLib.Application/Services/DeveloperTypeService.cs
index 4120e27a..2be15f48 100644
--- a/src/YANLib.Application/Services/DeveloperTypeService.cs
+++ b/src/YANLib.Application/Services/DeveloperTypeService.cs
@@ -37,6 +37,7 @@ public async ValueTask> GetAll()
catch (Exception ex)
{
_logger.LogError(ex, "GetAllDeveloperTypeService-Exception");
+
throw;
}
}
@@ -47,7 +48,7 @@ public async ValueTask Get(int code)
{
var rslt = ObjectMapper.Map(await _redisService.Get(DeveloperTypeGroup, code.ToString()));
- if (rslt is not null)
+ if (rslt.IsNotNull())
{
rslt.Code = code;
}
@@ -57,6 +58,7 @@ public async ValueTask Get(int code)
catch (Exception ex)
{
_logger.LogError(ex, "GetDeveloperTypeService-Exception: {Code}", code);
+
throw;
}
}
@@ -67,7 +69,7 @@ public async ValueTask Create(DeveloperTypeCreateRequest
{
var dto = await _redisService.Get(DeveloperTypeGroup, request.Code.ToString());
- if (dto is not null)
+ if (dto.IsNotNull())
{
throw new BusinessException(EXIST_ID).WithData("Code", request.Code);
}
@@ -78,7 +80,7 @@ public async ValueTask Create(DeveloperTypeCreateRequest
var mdl = await _repository.InsertAsync(ent);
- if (mdl is not null)
+ if (mdl.IsNotNull())
{
_ = await _redisService.Set(DeveloperTypeGroup, mdl.Id.ToString(), ObjectMapper.Map(mdl));
}
@@ -88,6 +90,7 @@ public async ValueTask Create(DeveloperTypeCreateRequest
catch (Exception ex)
{
_logger.LogError(ex, "CreateDeveloperTypeService-Exception: {Request}", request.Serialize());
+
throw;
}
}
@@ -108,7 +111,7 @@ public async ValueTask Update(int code, DeveloperTypeUpda
var mdl = await _repository.UpdateAsync(ent);
- if (mdl is not null)
+ if (mdl.IsNotNull())
{
_ = await _redisService.Set(DeveloperTypeGroup, mdl.Id.ToString(), ObjectMapper.Map(mdl));
}
@@ -118,6 +121,7 @@ public async ValueTask Update(int code, DeveloperTypeUpda
catch (Exception ex)
{
_logger.LogError(ex, "UpdateDeveloperTypeService-Exception: {Request}", request.Serialize());
+
throw;
}
}
@@ -139,6 +143,7 @@ public async ValueTask SyncDbToRedis()
catch (Exception ex)
{
_logger.LogError(ex, "SyncDbToRedisDeveloperTypeService-Exception");
+
throw;
}
}
diff --git a/src/YANLib.Application/Services/YANJsonService.cs b/src/YANLib.Application/Services/YANJsonService.cs
index 7e28c406..80a01bd5 100644
--- a/src/YANLib.Application/Services/YANJsonService.cs
+++ b/src/YANLib.Application/Services/YANJsonService.cs
@@ -12,7 +12,9 @@
namespace YANLib.Services;
-public class YANJsonService(IJsonSerializer jsonSerializer) : YANLibAppService, IYANJsonService
+public class YANJsonService(
+ IJsonSerializer jsonSerializer
+) : YANLibAppService, IYANJsonService
{
private readonly IJsonSerializer _jsonSerializer = jsonSerializer;
diff --git a/src/YANLib.Application/YANLib.Application.csproj b/src/YANLib.Application/YANLib.Application.csproj
index 3f402bc5..d4a57e93 100644
--- a/src/YANLib.Application/YANLib.Application.csproj
+++ b/src/YANLib.Application/YANLib.Application.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
preview
@@ -19,9 +19,9 @@
-
-
-
+
+
+
diff --git a/src/YANLib.Domain.Shared/YANLib.Domain.Shared.csproj b/src/YANLib.Domain.Shared/YANLib.Domain.Shared.csproj
index 691154ac..749faf79 100644
--- a/src/YANLib.Domain.Shared/YANLib.Domain.Shared.csproj
+++ b/src/YANLib.Domain.Shared/YANLib.Domain.Shared.csproj
@@ -3,10 +3,11 @@
- net7.0
+ net6.0
YANLib
true
preview
+ 5e7d84bc-8a98-4add-a91f-9d82c1e4c7a3
@@ -15,8 +16,8 @@
-
-
+
+
diff --git a/src/YANLib.Domain/YANLib.Domain.csproj b/src/YANLib.Domain/YANLib.Domain.csproj
index 33785872..d4414877 100644
--- a/src/YANLib.Domain/YANLib.Domain.csproj
+++ b/src/YANLib.Domain/YANLib.Domain.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
preview
@@ -13,7 +13,7 @@
-
+
diff --git a/src/YANLib.EntityFrameworkCore/Repositories/DeveloperRepository.cs b/src/YANLib.EntityFrameworkCore/Repositories/DeveloperRepository.cs
index abffadb5..2476a335 100644
--- a/src/YANLib.EntityFrameworkCore/Repositories/DeveloperRepository.cs
+++ b/src/YANLib.EntityFrameworkCore/Repositories/DeveloperRepository.cs
@@ -40,7 +40,8 @@ public async ValueTask Create(Developer entity)
if (await _dbContext.SaveChangesAsync() > 0)
{
- entity.DeveloperType = await _dbContext.DeveloperTypes.AsNoTracking().SingleOrDefaultAsync(x => x.Id == entity.DeveloperTypeCode);
+ entity.DeveloperType = await _dbContext.DeveloperTypes.SingleOrDefaultAsync(x => x.Id == entity.DeveloperTypeCode);
+
return entity;
}
else
@@ -59,10 +60,13 @@ public async ValueTask Adjust(Developer entity)
{
try
{
- if (await _dbContext.Developers.Where(x => x.IdCard == entity.IdCard).ExecuteUpdateAsync(s => s
- .SetProperty(x => x.IsActive, false)
- .SetProperty(x => x.UpdatedAt, Now)) > 0)
+ var dev = await _dbContext.Developers.FirstOrDefaultAsync(x => x.IdCard == entity.IdCard);
+
+ if (dev.IsNotNull())
{
+ dev.IsActive = false;
+ dev.UpdatedAt = Now;
+
entity.IsActive = true;
entity.Version++;
entity.CreatedAt = Now;
@@ -70,18 +74,13 @@ public async ValueTask Adjust(Developer entity)
if (await _dbContext.SaveChangesAsync() > 0)
{
- entity.DeveloperType = await _dbContext.DeveloperTypes.AsNoTracking().SingleOrDefaultAsync(x => x.Id == entity.DeveloperTypeCode);
+ entity.DeveloperType = await _dbContext.DeveloperTypes.SingleOrDefaultAsync(x => x.Id == entity.DeveloperTypeCode);
+
return entity;
}
- else
- {
- return default;
- }
- }
- else
- {
- return default;
}
+
+ return default;
}
catch (Exception ex)
{
diff --git a/src/YANLib.EntityFrameworkCore/YANLib.EntityFrameworkCore.csproj b/src/YANLib.EntityFrameworkCore/YANLib.EntityFrameworkCore.csproj
index 394dece4..1405d59f 100644
--- a/src/YANLib.EntityFrameworkCore/YANLib.EntityFrameworkCore.csproj
+++ b/src/YANLib.EntityFrameworkCore/YANLib.EntityFrameworkCore.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
preview
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/src/YANLib.HttpApi.Client/YANLib.HttpApi.Client.csproj b/src/YANLib.HttpApi.Client/YANLib.HttpApi.Client.csproj
index a9d4f642..098dea7a 100644
--- a/src/YANLib.HttpApi.Client/YANLib.HttpApi.Client.csproj
+++ b/src/YANLib.HttpApi.Client/YANLib.HttpApi.Client.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
preview
@@ -13,7 +13,7 @@
-
+
diff --git a/src/YANLib.HttpApi/YANLib.HttpApi.csproj b/src/YANLib.HttpApi/YANLib.HttpApi.csproj
index f3e585a1..81a11b6b 100644
--- a/src/YANLib.HttpApi/YANLib.HttpApi.csproj
+++ b/src/YANLib.HttpApi/YANLib.HttpApi.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net6.0
YANLib
preview
@@ -16,7 +16,7 @@
-
+
diff --git a/src/YANLib.MongoDB/YANLib.MongoDB.csproj b/src/YANLib.MongoDB/YANLib.MongoDB.csproj
index 858f7d89..a3223933 100644
--- a/src/YANLib.MongoDB/YANLib.MongoDB.csproj
+++ b/src/YANLib.MongoDB/YANLib.MongoDB.csproj
@@ -1,14 +1,14 @@
- net7.0
+ net6.0
enable
enable
preview
-
+
diff --git a/test/YANLib.Test/YANLib.Test.csproj b/test/YANLib.Test/YANLib.Test.csproj
index f2e9fd54..c64c068f 100644
--- a/test/YANLib.Test/YANLib.Test.csproj
+++ b/test/YANLib.Test/YANLib.Test.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net6.0
enable
enable
@@ -10,9 +10,9 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all