- Introduced XmlSer class for XML serialization and deserialization. - Added TypeMetaCache for caching type metadata and reflection information. - Implemented various ITypeHandler implementations for handling different types (Primitive, Proxy, ISerializable, Collection, Object). - Enhanced type resolution with TypeResolver to manage type lookups and conversions. - Established a configuration class (XmlCfg) to manage serialization settings. - Integrated support for handling graphs and references in serialized objects. - Added extensive member processing and filtering based on attributes. - Ensured compatibility with immutable collections and various data structures. - Implemented detailed error handling and logging for serialization processes.
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
#nullable enable
|
|
|
|
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using imm;
|
|
|
|
/// <summary>
|
|
/// Helper static class for processing immutable objects using a 'ref' pattern.
|
|
/// Provides different levels of processing based on the type.
|
|
/// </summary>
|
|
public static class iu
|
|
{
|
|
/// <summary>
|
|
/// Processes a 'Versioned' object (Level 1).
|
|
/// </summary>
|
|
public static T LightProcess<T>(
|
|
ref T obj,
|
|
Func<T, T> fn,
|
|
string reason = "Processed")
|
|
where T : Versioned<T>
|
|
{
|
|
obj = obj.Process(fn, reason);
|
|
return obj;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Processes a 'Recorded' object (Level 2), capturing caller info.
|
|
/// </summary>
|
|
public static T Process<T>(
|
|
ref T obj,
|
|
Func<T, T> fn,
|
|
string reason = "",
|
|
[CallerMemberName] string dbgName = "",
|
|
[CallerFilePath] string dbgPath = "",
|
|
[CallerLineNumber] int dbgLine = 0,
|
|
[CallerArgumentExpression("fn")] string dbgExpression = "")
|
|
where T : Recorded<T> // Catches Recorded and Timed
|
|
{
|
|
// This will call the 'Timed' override if T is Timed,
|
|
// or the 'Recorded' override if T is Recorded.
|
|
obj = obj.Process(fn, reason, dbgName, dbgPath, dbgLine, dbgExpression);
|
|
return obj;
|
|
}
|
|
|
|
// No specific Process needed for Timed, as it's caught by Recorded<T>
|
|
// and its Process override handles the timing.
|
|
} |