diff --git a/AyCode.Core.Tests/Serialization/AcExpressionNodeSerializationTests.cs b/AyCode.Core.Tests/Serialization/AcExpressionNodeSerializationTests.cs
index 794269e..69eaa3e 100644
--- a/AyCode.Core.Tests/Serialization/AcExpressionNodeSerializationTests.cs
+++ b/AyCode.Core.Tests/Serialization/AcExpressionNodeSerializationTests.cs
@@ -236,7 +236,7 @@ public class AcExpressionNodeSerializationTests
#endregion
- #region SetValue/GetValue Tests
+ #region SetValue/GetDynamicValue Tests
[TestMethod]
[DataRow(42, ConstantValueType.Int32)]
diff --git a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.BinaryDeserializeTypeMetadata.cs b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.BinaryDeserializeTypeMetadata.cs
index 746c28c..d7ca6dc 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.BinaryDeserializeTypeMetadata.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.BinaryDeserializeTypeMetadata.cs
@@ -151,7 +151,7 @@ public static partial class AcBinaryDeserializer
public new bool IsIIdCollection => _isManualConstruction ? _manualIsIIdCollection : base.IsIIdCollection;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public new object? GetValue(object target) => _isManualConstruction ? _manualGetter!(target) : base.GetValue(target);
+ public new object? GetValue(object target) => _isManualConstruction ? _manualGetter!(target) : base.GetDynamicValue(target);
public override void SetValue(object target, object? value)
{
diff --git a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.Populate.cs b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.Populate.cs
index f76f7f3..42bca2b 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.Populate.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.Populate.cs
@@ -515,43 +515,7 @@ public static partial class AcBinaryDeserializer
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void SetPropertyToDefault(object target, BinaryPropertySetterInfo propInfo)
- {
- switch (propInfo.SetterType)
- {
- case PropertyAccessorType.Int32:
- propInfo.SetInt32(target, 0);
- return;
- case PropertyAccessorType.Int64:
- propInfo.SetInt64(target, 0L);
- return;
- case PropertyAccessorType.Boolean:
- propInfo.SetBoolean(target, false);
- return;
- case PropertyAccessorType.Double:
- propInfo.SetDouble(target, 0.0);
- return;
- case PropertyAccessorType.Single:
- propInfo.SetSingle(target, 0f);
- return;
- case PropertyAccessorType.Decimal:
- propInfo.SetDecimal(target, 0m);
- return;
- case PropertyAccessorType.DateTime:
- propInfo.SetDateTime(target, default);
- return;
- case PropertyAccessorType.Guid:
- propInfo.SetGuid(target, default);
- return;
- case PropertyAccessorType.Enum:
- propInfo.SetEnumAsInt32(target, 0);
- return;
- case PropertyAccessorType.Object:
- default:
- // Reference types and nullable value types: set to null
- propInfo.SetValue(target, null);
- return;
- }
- }
+ => propInfo.SetToDefault(target);
///
/// Determines if a type is a complex type (not primitive, string, or simple value type).
@@ -573,3 +537,4 @@ public static partial class AcBinaryDeserializer
#endregion
}
+
diff --git a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.cs b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.cs
index 7d3d3fd..b3cf9e1 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinaryDeserializer.cs
@@ -510,11 +510,11 @@ public static partial class AcBinaryDeserializer
private static bool TryReadAndSetTypedValue(ref BinaryDeserializationContext context, object target, BinaryPropertySetterInfo propInfo, byte peekCode)
{
// Only handle if we have a typed setter
- if (propInfo.SetterType == PropertyAccessorType.Object)
+ if (propInfo.AccessorType == PropertyAccessorType.Object)
return false;
// Handle based on property setter type and incoming data type
- switch (propInfo.SetterType)
+ switch (propInfo.AccessorType)
{
case PropertyAccessorType.Int32:
if (BinaryTypeCode.IsTinyInt(peekCode))
@@ -1474,3 +1474,4 @@ public static partial class AcBinaryDeserializer
}
// Implementation moved to AcBinaryDeserializer.TypeConversionInfo.cs
+
diff --git a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
index 92a9faf..01d1291 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
@@ -430,7 +430,7 @@ public static partial class AcBinarySerializer
property.DeclaringType,
property.Name,
property.PropertyType,
- property.ObjectGetter);
+ property.DynamicGetter);
return PropertyFilter(context);
}
diff --git a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
index 8f68b0d..d299588 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
@@ -747,7 +747,7 @@ public static partial class AcBinarySerializer
return false;
default:
// Object type - use regular getter
- var value = prop.GetValue(obj);
+ var value = prop.GetDynamicValue(obj);
if (value == null) return true;
if (prop.PropertyTypeCode == TypeCode.String) return string.IsNullOrEmpty((string)value);
return false;
@@ -818,7 +818,7 @@ public static partial class AcBinarySerializer
return;
default:
// Fallback to object getter for reference types
- var value = prop.GetValue(obj);
+ var value = prop.GetDynamicValue(obj);
WriteValue(value, prop.PropertyType, context, depth);
return;
}
@@ -975,7 +975,7 @@ public static partial class AcBinarySerializer
default:
{
// Object type - use regular getter
- var value = prop.GetValue(obj);
+ var value = prop.GetDynamicValue(obj);
// SKIP marker only for null (reference types)
// Empty string, empty collections, etc. are valid values and must be written!
diff --git a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
index 2f60f88..e0d1991 100644
--- a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
+++ b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
@@ -5,8 +5,9 @@ using static AyCode.Core.Helpers.JsonUtilities;
namespace AyCode.Core.Serializers.Binaries;
///
-/// Binary-specific property accessor base class.
-/// Adds typed getters to avoid boxing during serialization.
+/// Binary-specific property accessor.
+/// Inherits typed getters from PropertyAccessorBase.
+/// Adds Binary-specific properties: PropertyIndex, CachedPropertyNameIndex.
///
public abstract class BinaryPropertyAccessorBase : PropertyAccessorBase
{
@@ -23,130 +24,14 @@ public abstract class BinaryPropertyAccessorBase : PropertyAccessorBase
///
public int PropertyIndex { get; internal set; } = -1;
- ///
- /// The accessor type for fast typed getter dispatch.
- ///
- public PropertyAccessorType AccessorType { get; }
-
- ///
- /// Typed getter delegate (type depends on AccessorType).
- ///
- protected readonly Delegate? _typedGetter;
-
///
/// Object getter for property filter context.
///
- public Func