mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 优化 TypeHandlers 支持 DateTime 映射规则;#1634
This commit is contained in:
@ -612,9 +612,10 @@ namespace FreeSql
|
||||
{
|
||||
if (e.Property.PropertyType == typeHandler.Type)
|
||||
{
|
||||
if (_dicTypeHandlerTypes.ContainsKey(e.Property.PropertyType) == false &&
|
||||
if (_dicTypeHandlerTypes.ContainsKey(e.Property.PropertyType)) return;
|
||||
if (e.Property.PropertyType.NullableTypeOrThis() != typeof(DateTime) &&
|
||||
FreeSql.Internal.Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(e.Property.PropertyType))
|
||||
return; //基础类型无效
|
||||
return; //基础类型无效,DateTime 除外
|
||||
|
||||
if (_dicTypeHandlerTypes.TryAdd(e.Property.PropertyType, true))
|
||||
{
|
||||
|
@ -2447,6 +2447,14 @@ namespace FreeSql.Internal
|
||||
);
|
||||
break;
|
||||
case "System.DateTime":
|
||||
if (TypeHandlers.ContainsKey(type))
|
||||
{
|
||||
foreach (var switchFunc in GetDataReaderValueBlockExpressionSwitchTypeFullName)
|
||||
{
|
||||
var switchFuncRet = switchFunc(returnTarget, valueExp, type);
|
||||
if (switchFuncRet != null) return switchFuncRet;
|
||||
}
|
||||
}
|
||||
tryparseExp = Expression.Block(
|
||||
new[] { tryparseVarExp = Expression.Variable(typeof(DateTime)) },
|
||||
new Expression[] {
|
||||
|
Reference in New Issue
Block a user