mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	延时加载友好错误提示
This commit is contained in:
		@@ -17,26 +17,31 @@ public class g {
 | 
			
		||||
			(cmd, traceLog) => {
 | 
			
		||||
				Console.WriteLine(traceLog);
 | 
			
		||||
			}) //监听SQL命令对象,在执行后
 | 
			
		||||
		.UseLazyLoading(true)
 | 
			
		||||
		.Build();
 | 
			
		||||
 | 
			
		||||
	public static IFreeSql sqlserver = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
		.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=cms;Pooling=true;Max Pool Size=10")
 | 
			
		||||
		.UseAutoSyncStructure(true)
 | 
			
		||||
		.UseLazyLoading(true)
 | 
			
		||||
		.Build();
 | 
			
		||||
 | 
			
		||||
	public static IFreeSql pgsql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
		.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=10")
 | 
			
		||||
		.UseAutoSyncStructure(true)
 | 
			
		||||
		.UseSyncStructureToLower(true)
 | 
			
		||||
		.UseLazyLoading(true)
 | 
			
		||||
		.Build();
 | 
			
		||||
 | 
			
		||||
	public static IFreeSql oracle = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
		.UseConnectionString(FreeSql.DataType.Oracle, "user id=user1;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=10")
 | 
			
		||||
		.UseAutoSyncStructure(true)
 | 
			
		||||
		.UseLazyLoading(true)
 | 
			
		||||
		.Build();
 | 
			
		||||
 | 
			
		||||
	public static IFreeSql sqlite = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
		.UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=|DataDirectory|\document.db;Attachs=xxxtb.db;Pooling=true;Max Pool Size=10")
 | 
			
		||||
		.UseAutoSyncStructure(true)
 | 
			
		||||
		.UseLazyLoading(true)
 | 
			
		||||
		.Build();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ namespace FreeSql.Internal {
 | 
			
		||||
 | 
			
		||||
				if (common.CodeFirst.IsLazyLoading && virtualProps.Any()) {
 | 
			
		||||
					//virtual 属性延时加载,生态产生新的重写类
 | 
			
		||||
					if (trytb.Type.IsNotPublic) throw new Exception("【延时加载】功能发生错误,实体类必须声明为 public");
 | 
			
		||||
					if (trytb.Type.IsNestedPublic == false) throw new Exception("【延时加载】功能发生错误,实体类必须声明为 public");
 | 
			
		||||
 | 
			
		||||
					var overrieds = 0;
 | 
			
		||||
					var cscode = new StringBuilder();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user