mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 优化 内部实体管理的默认值,防止导航属性使用抽象类/接口时出现错误;
This commit is contained in:
		@@ -155,8 +155,7 @@ namespace FreeSql.Internal
 | 
				
			|||||||
                    trytb.ColumnsByCsIgnore.Add(p.Name, col);
 | 
					                    trytb.ColumnsByCsIgnore.Add(p.Name, col);
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (entityDefault == null) entityDefault = Activator.CreateInstance(entity);
 | 
					                if (entityDefault != null) colattr.DbDefautValue = trytb.Properties[p.Name].GetValue(entityDefault);
 | 
				
			||||||
                colattr.DbDefautValue = trytb.Properties[p.Name].GetValue(entityDefault);
 | 
					 | 
				
			||||||
                if (colattr.DbDefautValue != null && p.PropertyType != colattr.MapType) colattr.DbDefautValue = Utils.GetDataReaderValue(colattr.MapType, colattr.DbDefautValue);
 | 
					                if (colattr.DbDefautValue != null && p.PropertyType != colattr.MapType) colattr.DbDefautValue = Utils.GetDataReaderValue(colattr.MapType, colattr.DbDefautValue);
 | 
				
			||||||
                if (colattr.DbDefautValue == null) colattr.DbDefautValue = tp?.defaultValue;
 | 
					                if (colattr.DbDefautValue == null) colattr.DbDefautValue = tp?.defaultValue;
 | 
				
			||||||
                if (colattr.IsNullable == false && colattr.DbDefautValue == null)
 | 
					                if (colattr.IsNullable == false && colattr.DbDefautValue == null)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user