internal static IMemberConfiguration Member(this ITypeConfiguration @this, string member) { var metadata = @this.Get() .GetMember(member) .SingleOrDefault(); var result = metadata != null? @this.AsInternal().Member(metadata) : null; return(result); }
public static ITypeConfiguration <T> Member <T>(this ITypeConfiguration <T> @this, MemberInfo member) => @this.AsInternal().Member(member).Return(@this);
/// <summary> /// Get (or create) the member configuration from the type that resolves with the provided member metadata. /// </summary> /// <typeparam name="T">The type under configuration.</typeparam> /// <param name="this">The type configuration to configure.</param> /// <param name="member">The metadata used to query the type.</param> /// <returns>The located member configuration.</returns> public static IMemberConfiguration MemberBy <T>(this ITypeConfiguration <T> @this, MemberInfo member) => @this.AsInternal().Member(member);
/// <summary> /// Get (or create) the member configuration from the type that resolves with the provided expression. /// </summary> /// <typeparam name="T">The type under configuration.</typeparam> /// <typeparam name="TMember">The type of the member's value.</typeparam> /// <param name="this">The type configuration to configure.</param> /// <param name="member">The expression to that resolves to a member of the type under configuration.</param> /// <returns>The requested member configuration.</returns> public static IMemberConfiguration <T, TMember> Member <T, TMember>(this ITypeConfiguration <T> @this, Expression <Func <T, TMember> > member) => @this.AsInternal() .Member(member.GetMemberInfo()) .AsValid <MemberConfiguration <T, TMember> >();
/* Type */ /// <summary> /// Applies a name for the type. This provided name will be used to emit the type when needed during serialization, /// and again when needed during the reading of a deserialization. /// </summary> /// <typeparam name="T">The type under configuration.</typeparam> /// <param name="this">The type configuration to configure.</param> /// <param name="name">The name to apply to the type.</param> /// <returns>The configured type configuration.</returns> public static ITypeConfiguration <T> Name <T>(this ITypeConfiguration <T> @this, string name) => @this.AsInternal().Name(name).Return(@this);