Dont serialize delegates

This commit is contained in:
Marc Hernandez 2025-10-16 15:13:02 -07:00
parent d6135116f1
commit 7abfe28e9b

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;
namespace imm; namespace imm;
@ -51,6 +52,7 @@ public interface Obj<T> : Obj where T : Obj<T>
/// <summary> /// <summary>
/// Gets the change delegate associated with this object. /// Gets the change delegate associated with this object.
/// </summary> /// </summary>
[JsonIgnore]
ChangeDelegate<T> OnChange { get; set; } ChangeDelegate<T> OnChange { get; set; }
/// <summary> /// <summary>
@ -168,7 +170,7 @@ public record class Versioned<T> : Obj<T> where T : Versioned<T>
{ {
public Metadata_Versioned Meta { get; init; } = new(); public Metadata_Versioned Meta { get; init; } = new();
[DebuggerBrowsable( DebuggerBrowsableState.Never )] [DebuggerBrowsable( DebuggerBrowsableState.Never )]
public ChangeDelegate<T> OnChange { get; set; } = ( o, n ) => { }; public ChangeDelegate<T> OnChange { get; set; } = ( o, n ) => { };
public virtual Obj? Old => null; public virtual Obj? Old => null;
@ -179,7 +181,7 @@ public record class Versioned<T> : Obj<T> where T : Versioned<T>
public Versioned() { } public Versioned() { }
protected Versioned( Versioned<T> original ) protected Versioned( Versioned<T> original )
{ {
OnChange = original.OnChange; OnChange = original.OnChange;
Meta = original.Meta; Meta = original.Meta;
} }