- 增加 TypeHandler override FluentApi 设置;

This commit is contained in:
2881099 2024-08-19 23:35:08 +08:00
parent 3335a84158
commit 402ff40135
2 changed files with 5 additions and 1 deletions

View File

@ -613,6 +613,7 @@ namespace FreeSql
{ {
if (e.Property.PropertyType == typeHandler.Type) if (e.Property.PropertyType == typeHandler.Type)
{ {
typeHandler.FluentApi(new ColumnFluent(e.ModifyResult, e.Property, e.EntityType));
if (_dicTypeHandlerTypes.ContainsKey(e.Property.PropertyType)) return; if (_dicTypeHandlerTypes.ContainsKey(e.Property.PropertyType)) return;
if (e.Property.PropertyType.NullableTypeOrThis() != typeof(DateTime) && if (e.Property.PropertyType.NullableTypeOrThis() != typeof(DateTime) &&
FreeSql.Internal.Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(e.Property.PropertyType)) FreeSql.Internal.Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(e.Property.PropertyType))

View File

@ -1,4 +1,5 @@
using FreeSql.Internal.Model.Interface; using FreeSql.DataAnnotations;
using FreeSql.Internal.Model.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -12,12 +13,14 @@ namespace FreeSql.Internal.Model
Type Type { get; } Type Type { get; }
object Deserialize(object value); object Deserialize(object value);
object Serialize(object value); object Serialize(object value);
void FluentApi(ColumnFluent col);
} }
} }
public abstract class TypeHandler<T> : ITypeHandler public abstract class TypeHandler<T> : ITypeHandler
{ {
public abstract T Deserialize(object value); public abstract T Deserialize(object value);
public abstract object Serialize(T value); public abstract object Serialize(T value);
public virtual void FluentApi(ColumnFluent col) { }
public Type Type => typeof(T); public Type Type => typeof(T);
object ITypeHandler.Deserialize(object value) => this.Deserialize(value); object ITypeHandler.Deserialize(object value) => this.Deserialize(value);