/// <summary> /// Create a document mapping with an identity mappings and field mappings /// </summary> /// <param name="documentType">The type of the document mapped</param> /// <param name="identity">The identity mappings</param> /// <param name="fields">The fields mappings</param> public DocumentMapping(Type documentType, IdentityMapping identity, IEnumerable <FieldMapping> fields) { this.documentType = documentType; this.identity = identity; this.fields.AddRange(fields); allFields.Add(identity); allFields.AddRange(this.fields); }
/// <summary> /// Creates mappings for the identity field given a builder /// </summary> /// <param name="builder">The builder for the identity field</param> /// <returns>The newly create identity mappings</returns> public IdentityMapping CreateIdentity(IdentityBuilder builder) { // Create the identity from the member backing the identity builder var identity = new IdentityMapping(builder.Member); // Set additionnal values identity.Name = builder.FieldName ?? builder.Member.Name; // Find the mapping type identity.MappingType = TypeFactory.GetFor(builder.Member.MemberType); // Return the newly created identity return(identity); }