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