mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 TypeHandlers 支持 Enum 枚举映射规则;#1634
This commit is contained in:
@ -10,6 +10,16 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
partial class AdoProvider
|
||||
{
|
||||
public object AddslashesTypeHandler(Type type, object param)
|
||||
{
|
||||
if (Utils.TypeHandlers.TryGetValue(type, out var typeHandler))
|
||||
{
|
||||
var result = typeHandler.Serialize(param);
|
||||
return AddslashesProcessParam(result, null, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn);
|
||||
public string Addslashes(string filter, params object[] parms)
|
||||
{
|
||||
|
@ -2509,7 +2509,7 @@ namespace FreeSql.Internal
|
||||
);
|
||||
break;
|
||||
default:
|
||||
if (type.IsEnum)
|
||||
if (type.IsEnum && TypeHandlers.ContainsKey(type) == false)
|
||||
return Expression.Block(
|
||||
Expression.IfThenElse(
|
||||
Expression.Equal(Expression.TypeAs(valueExp, typeof(string)), Expression.Constant(string.Empty)),
|
||||
|
Reference in New Issue
Block a user