mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 优化 ExpressionTree 类型转换的友好错误提示;
This commit is contained in:
		@@ -1770,8 +1770,15 @@ namespace FreeSql.Internal
 | 
				
			|||||||
                var exp = GetDataReaderValueBlockExpression(type, parmExp);
 | 
					                var exp = GetDataReaderValueBlockExpression(type, parmExp);
 | 
				
			||||||
                return Expression.Lambda<Func<object, object>>(exp, parmExp).Compile();
 | 
					                return Expression.Lambda<Func<object, object>>(exp, parmExp).Compile();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					            try
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                return func(value);
 | 
					                return func(value);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            catch (Exception ex)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                throw new ArgumentException($"ExpressionTree 转换类型错误,值({string.Concat(value)}),类型({value.GetType().FullName}),目标类型({type.FullName}),{ex.Message}");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        public static string GetCsName(string name)
 | 
					        public static string GetCsName(string name)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            name = Regex.Replace(name.TrimStart('@'), @"[^\w]", "_");
 | 
					            name = Regex.Replace(name.TrimStart('@'), @"[^\w]", "_");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user