修复 导航属性的关系,误将 ManyToOne 设置成了 OneToMany

This commit is contained in:
28810 2019-04-01 20:07:16 +08:00
parent 1132a094ae
commit 5380a9df00
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ namespace FreeSql.Internal.Model {
internal void AddOrUpdateTableRef(string propertyName, TableRef tbref) {
_refs.AddOrUpdate(propertyName, tbref, (ok, ov) => tbref);
}
internal TableRef GetTableRef(string propertyName, bool isThrowException) {
public TableRef GetTableRef(string propertyName, bool isThrowException) {
if (_refs.TryGetValue(propertyName, out var tryref) == false) return null;
if (tryref.Exception != null) {
if (isThrowException) throw tryref.Exception;
@ -34,7 +34,7 @@ namespace FreeSql.Internal.Model {
}
}
internal class TableRef {
public class TableRef {
public PropertyInfo Property { get; set; }
public TableRefType RefType { get; set; }
@ -51,7 +51,7 @@ namespace FreeSql.Internal.Model {
public Exception Exception { get; set; }
}
internal enum TableRefType {
public enum TableRefType {
OneToOne, ManyToOne, OneToMany, ManyToMany
}
}

View File

@ -545,7 +545,7 @@ namespace FreeSql.Internal {
}
if (nvref.Columns.Count > 0 && nvref.RefColumns.Count > 0) {
nvref.RefEntityType = tbref.Type;
nvref.RefType = isOnoToOne ? TableRefType.OneToOne : TableRefType.OneToMany;
nvref.RefType = isOnoToOne ? TableRefType.OneToOne : TableRefType.ManyToOne;
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
}