mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	修复 导航属性的关系,误将 ManyToOne 设置成了 OneToMany
This commit is contained in:
		@@ -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
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user