Browse Source

Update error tip

SqlSugar5
sunkaixuan 2 years ago
parent
commit
84af1f46ce
  1. 6
      Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs
  2. 6
      Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs
  3. 6
      Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/UpdateNavManyToMany.cs

6
Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs

@ -16,13 +16,13 @@ namespace SqlSugar
var parentNavigateProperty = parentEntity.Columns.FirstOrDefault(it => it.PropertyName == name);
var thisEntity = this._Context.EntityMaintenance.GetEntityInfo<TChild>();
var thisPkColumn = thisEntity.Columns.FirstOrDefault(it => it.IsPrimarykey == true);
Check.Exception(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.Exception(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
Check.ExceptionEasy(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.ExceptionEasy(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
var mappingType = parentNavigateProperty.Navigat.MappingType;
var mappingEntity = this._Context.EntityMaintenance.GetEntityInfo(mappingType);
var mappingA = mappingEntity.Columns.FirstOrDefault(x => x.PropertyName == parentNavigateProperty.Navigat.MappingAId);
var mappingB = mappingEntity.Columns.FirstOrDefault(x => x.PropertyName == parentNavigateProperty.Navigat.MappingBId);
Check.Exception(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
Check.ExceptionEasy(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
var mappingPk = mappingEntity.Columns
.Where(it => it.PropertyName != mappingA.PropertyName)
.Where(it => it.PropertyName != mappingB.PropertyName)

6
Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/InsertNavProviderManyToMany.cs

@ -16,13 +16,13 @@ namespace SqlSugar
var parentNavigateProperty = parentEntity.Columns.FirstOrDefault(it => it.PropertyName == name);
var thisEntity = this._Context.EntityMaintenance.GetEntityInfo<TChild>();
var thisPkColumn = thisEntity.Columns.FirstOrDefault(it => it.IsPrimarykey == true);
Check.Exception(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.Exception(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
Check.ExceptionEasy(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.ExceptionEasy(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
var mappingType=parentNavigateProperty.Navigat.MappingType;
var mappingEntity = this._Context.EntityMaintenance.GetEntityInfo(mappingType);
var mappingA = mappingEntity.Columns.FirstOrDefault(x=>x.PropertyName== parentNavigateProperty.Navigat.MappingAId);
var mappingB = mappingEntity.Columns.FirstOrDefault(x => x.PropertyName == parentNavigateProperty.Navigat.MappingBId);
Check.Exception(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
Check.ExceptionEasy(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
var mappingPk = mappingEntity.Columns
.Where(it => it.PropertyName != mappingA.PropertyName)
.Where(it => it.PropertyName != mappingB.PropertyName)

6
Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/UpdateNavManyToMany.cs

@ -16,13 +16,13 @@ namespace SqlSugar
var parentNavigateProperty = parentEntity.Columns.FirstOrDefault(it => it.PropertyName == name);
var thisEntity = this._Context.EntityMaintenance.GetEntityInfo<TChild>();
var thisPkColumn = thisEntity.Columns.FirstOrDefault(it => it.IsPrimarykey == true);
Check.Exception(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.Exception(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
Check.ExceptionEasy(thisPkColumn == null, $"{thisPkColumn.EntityName} need primary key", $"{thisPkColumn.EntityName}需要主键");
Check.ExceptionEasy(parentPkColumn == null, $"{parentPkColumn.EntityName} need primary key", $"{parentPkColumn.EntityName}需要主键");
var mappingType = parentNavigateProperty.Navigat.MappingType;
var mappingEntity = this._Context.EntityMaintenance.GetEntityInfo(mappingType);
var mappingA = mappingEntity.Columns.FirstOrDefault(x => x.PropertyName == parentNavigateProperty.Navigat.MappingAId);
var mappingB = mappingEntity.Columns.FirstOrDefault(x => x.PropertyName == parentNavigateProperty.Navigat.MappingBId);
Check.Exception(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
Check.ExceptionEasy(mappingA == null || mappingB == null, $"Navigate property {name} error ", $"导航属性{name}配置错误");
var mappingPk = mappingEntity.Columns
.Where(it => it.PropertyName != mappingA.PropertyName)
.Where(it => it.PropertyName != mappingB.PropertyName)

Loading…
Cancel
Save