public static ITypeConfiguration <T> CustomSerializer <T>(this ITypeConfiguration <T> @this, IExtendedXmlCustomSerializer serializer) { @this.Root.With <CustomSerializationExtension>() .XmlSerializers.Assign(@this.Get(), serializer); return(@this); }
public static ITypeConfiguration <T> AddMigration <T>(this ITypeConfiguration <T> @this, IEnumerable <Action <XElement> > migrations) { @this.Root.With <MigrationsExtension>() .Add(@this.Get(), migrations.Fixed()); return(@this); }
public static ITypeConfiguration <T> EmitWhen <T>(this ITypeConfiguration <T> @this, Func <T, bool> specification) { @this.Root.With <AllowedInstancesExtension>() .Assign(@this.Get(), new AllowedValueSpecification(new DelegatedSpecification <T>(specification).AdaptForNull())); return(@this); }
internal static IMemberConfiguration Member(this ITypeConfiguration @this, string member) { var metadata = @this.Get() .GetMember(member) .SingleOrDefault(); var result = metadata != null ? ((IInternalTypeConfiguration)@this).Member(metadata) : null; return(result); }
public static ITypeConfiguration <T> Unregister <T>(this ITypeConfiguration <T> @this) { @this.Root.With <CustomSerializationExtension>() .Types.Remove(@this.Get()); return(@this); }
public static ITypeConfiguration <T> Register <T>(this ITypeConfiguration <T> @this, ISerializer serializer) { @this.Root.With <CustomSerializationExtension>() .Types.Assign(@this.Get(), serializer); return(@this); }
/// <summary> /// Adds a set of migration delegates to the configured type. A migration allows older persisted XML to migrate to an /// object model schema that has changed since the XML was persisted. The provided command specifies how to /// manipulate the element that represents the type so that it can (hopefully 😇) be deserialized without error. /// </summary> /// <param name="this">The type configuration to configure.</param> /// <param name="migrations">The delegates that specify how to migrate an Xml element that represents an older schema. /// </param> /// <returns>The configured type configuration.</returns> public static ITypeConfiguration AddMigration(this ITypeConfiguration @this, IEnumerable <Action <XElement> > migrations) => @this.Root.With <MigrationsExtension>() .Apply(@this.Get(), migrations.Fixed()) .Return(@this);
/// <summary> /// Marks a type as "allowed" so that it is emitted during serialization and read during deserialization. Note that /// including a type establishes an "allowed-only" policy so that only types that are explicitly included are /// considered for processing. /// </summary> /// <param name="this">The type configuration to configure.</param> /// <returns>The configured type configuration.</returns> public static ITypeConfiguration Include(this ITypeConfiguration @this) => @this.Root.With <AllowedTypesExtension>() .Allowed.Apply(@this.Get()) .Return(@this);
/// <summary> /// Marks the specified type as ignored, meaning it will not emit or read when encountered in a graph. /// </summary> /// <typeparam name="T">The type under configuration.</typeparam> /// <param name="this">The type configuration to configure.</param> /// <returns>The configured type configuration.</returns> public static ITypeConfiguration <T> Ignore <T>(this ITypeConfiguration <T> @this) => @this.Ignore(@this.Get()) .Return(@this);