mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 优化 ExpressionTree 类型转换的友好错误提示;
This commit is contained in:
parent
9cc8da637d
commit
2550611410
@ -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]", "_");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user