mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
修复 导航属性的关系,误将 ManyToOne 设置成了 OneToMany
This commit is contained in:
parent
1132a094ae
commit
5380a9df00
@ -24,7 +24,7 @@ namespace FreeSql.Internal.Model {
|
|||||||
internal void AddOrUpdateTableRef(string propertyName, TableRef tbref) {
|
internal void AddOrUpdateTableRef(string propertyName, TableRef tbref) {
|
||||||
_refs.AddOrUpdate(propertyName, tbref, (ok, ov) => 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 (_refs.TryGetValue(propertyName, out var tryref) == false) return null;
|
||||||
if (tryref.Exception != null) {
|
if (tryref.Exception != null) {
|
||||||
if (isThrowException) throw tryref.Exception;
|
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 PropertyInfo Property { get; set; }
|
||||||
|
|
||||||
public TableRefType RefType { get; set; }
|
public TableRefType RefType { get; set; }
|
||||||
@ -51,7 +51,7 @@ namespace FreeSql.Internal.Model {
|
|||||||
|
|
||||||
public Exception Exception { get; set; }
|
public Exception Exception { get; set; }
|
||||||
}
|
}
|
||||||
internal enum TableRefType {
|
public enum TableRefType {
|
||||||
OneToOne, ManyToOne, OneToMany, ManyToMany
|
OneToOne, ManyToOne, OneToMany, ManyToMany
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -545,7 +545,7 @@ namespace FreeSql.Internal {
|
|||||||
}
|
}
|
||||||
if (nvref.Columns.Count > 0 && nvref.RefColumns.Count > 0) {
|
if (nvref.Columns.Count > 0 && nvref.RefColumns.Count > 0) {
|
||||||
nvref.RefEntityType = tbref.Type;
|
nvref.RefEntityType = tbref.Type;
|
||||||
nvref.RefType = isOnoToOne ? TableRefType.OneToOne : TableRefType.OneToMany;
|
nvref.RefType = isOnoToOne ? TableRefType.OneToOne : TableRefType.ManyToOne;
|
||||||
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
|
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user