fix(dal,aihitMainSyncer): FieldValues поле Value теперь уникально. В aihitMainSyncer поднят уровень журналированияя
This commit is contained in:
@@ -71,7 +71,7 @@ namespace PARR.AIHITMainSyncer.Services
|
||||
if (isChanged && !await unitService.CommitAsync())
|
||||
logger.LogError($"Не удалось изменить Unit {objFromQuery.Name}");
|
||||
else
|
||||
logger.LogInformation($"----- Набор данных в Unit изменён: {objFromQuery.Name} -----");
|
||||
logger.LogDebug($"----- Набор данных в Unit изменён: {objFromQuery.Name} -----");
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace PARR.AIHITMainSyncer.Services
|
||||
if (!await unitService.CreateAsync(unit) || !await unitService.CommitAsync())
|
||||
logger.LogError($"Не удалось создать Unit {unit.Name}");
|
||||
else
|
||||
logger.LogInformation($"----- Создан Unit: {unit.Name} -----");
|
||||
logger.LogDebug($"----- Создан Unit: {unit.Name} -----");
|
||||
|
||||
return (await unitService.GetUnitByName(unit.Name))!;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace PARR.AIHITMainSyncer.Services
|
||||
if (!await unitFieldService.CreateAsync(field) || !await unitFieldService.CommitAsync())
|
||||
logger.LogError($"Не удалось создать запись в таблице Fields: {name}, {field.ToJson()}");
|
||||
else
|
||||
logger.LogInformation($"Создана запись а таблице Fields: {name}, {field.ToJson()}");
|
||||
logger.LogDebug($"Создана запись а таблице Fields: {name}, {field.ToJson()}");
|
||||
|
||||
return (await unitFieldService.GetAsync(field.Id))!;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ namespace PARR.AIHITMainSyncer.Services
|
||||
if (!await unitFieldValueService.CommitAsync())
|
||||
logger.LogError($"Не удалось создать связь таблицы FieldValues и Fields: {unitFieldValueService.ToJson()}");
|
||||
else
|
||||
logger.LogInformation($"Создана связь таблицы FieldValues и Fields: {unitFieldValueService.ToJson()}");
|
||||
logger.LogDebug($"Создана связь таблицы FieldValues и Fields: {unitFieldValueService.ToJson()}");
|
||||
}
|
||||
|
||||
return existUnitFieldValue;
|
||||
@@ -209,7 +209,7 @@ namespace PARR.AIHITMainSyncer.Services
|
||||
if (!await unitFieldValueService.CreateAsync(newValue) || !await unitFieldValueService.CommitAsync())
|
||||
logger.LogError($"Не удалось создать запись в таблице Values: {newValue.Value}, {newValue.ToJson()}");
|
||||
else
|
||||
logger.LogInformation($"Создана запись а таблице Values: {newValue.Value}, {newValue.ToJson()}");
|
||||
logger.LogDebug($"Создана запись а таблице Values: {newValue.Value}, {newValue.ToJson()}");
|
||||
|
||||
return (await unitFieldValueService.GetAsync(newValue.Id))!;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Debug"
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
|
||||
3487
PARR.DAL/Migrations/20250521063857_tblFieldValuesValueIsUniqueClmn.Designer.cs
generated
Normal file
3487
PARR.DAL/Migrations/20250521063857_tblFieldValuesValueIsUniqueClmn.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class tblFieldValuesValueIsUniqueClmn : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FieldValues_Value",
|
||||
schema: "unit",
|
||||
table: "FieldValues");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FieldValues_Value",
|
||||
schema: "unit",
|
||||
table: "FieldValues",
|
||||
column: "Value",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FieldValues_Value",
|
||||
schema: "unit",
|
||||
table: "FieldValues");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FieldValues_Value",
|
||||
schema: "unit",
|
||||
table: "FieldValues",
|
||||
column: "Value");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2621,7 +2621,8 @@ namespace PARR.DAL.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Value");
|
||||
b.HasIndex("Value")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("FieldValues", "unit", t =>
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace PARR.DAL.Models.Unit
|
||||
{
|
||||
[Table("FieldValues", Schema = DataContextSettings.Unit)]
|
||||
[Comment("Значения полей ЭК")]
|
||||
[Index(nameof(Value))]
|
||||
[Index(nameof(Value), IsUnique = true)]
|
||||
public class UnitFieldValue : IBase
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
|
||||
public async Task<UnitField?> GetByAihitNameAsync(string name)
|
||||
{
|
||||
return await EntitySet.FirstOrDefaultAsync(uf => uf.AihitName.ToLower() == name.ToLower());
|
||||
return await EntitySet.FirstOrDefaultAsync(uf => uf.AihitName.ToLower().Trim() == name.ToLower().Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user