MetalamaAPI documentationAspect APIMetalama.​Framework.​SerializationICompile­Time­Serializable
Open sandboxFocus

ICompileTimeSerializable Interface

Marks the implementing type as being serializable. Aspects and fabrics are typically serialized when they affect a different project than the current one (by inheritance or reference validation). Serialized objects may be deserialized on a different machine than the one on which they have been serialized, and a long time after.

Namespace: Metalama.Framework.Serialization
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface ICompileTimeSerializable
Remarks

When a type is marked as compile-time-serializable, all fields and automatic properties should be of a serializable type, except those annotated with the NonCompileTimeSerializedAttribute custom attribute.

The following system types are serializable: intrinsic types, arrays of serializable types, DateTime, System.TimeSpan, System.Globalization.CultureInfo, System.Guid, Dictionary<TKey,TValue>, System.Collections.Generic.List<>, System.Collections.Immutable.ImmutableArray<>, System.Collections.Immutable.ImmutableDictionary<, >.

To serialize another system type, implement a ReferenceTypeSerializer or ValueTypeSerializer<T> and register it by adding a ImportSerializerAttribute custom attribute to the types that uses it.

To serialize an IDeclaration, use the ToRef() method and store the IRef<T>.