|
|
@ -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) |
|
|
|