public override void Build(DomainMapper masterMap, Formatter<PropertyInfo> formatter) { base.Build(masterMap, formatter); var mappedType = masterMap.For(Property.PropertyType.GetGenericArguments()[0]); if(!mappedType.SubMappings.Any()) throw new Exception(string.Format("No mappings found type {0}", Property.PropertyType.GetGenericArguments()[0])); var foreignKey = mappedType.SubMappings.OfType<IdMapping>().First().Property; this.foreignRelationshipMapping = new ReverseForeignRelationshipMapping(Property, type, parentType, foreignKey, formatter); masterMap.For(type).Map(mapping => mapping.MapForeignRelationship(masterMap, Property, type, formatter)); }
public override void Build(DomainMapper masterMap, Formatter <PropertyInfo> formatter) { base.Build(masterMap, formatter); var mappedType = masterMap.For(Property.PropertyType.GetGenericArguments()[0]); if (!mappedType.SubMappings.Any()) { throw new Exception(string.Format("No mappings found type {0}", Property.PropertyType.GetGenericArguments()[0])); } var foreignKey = mappedType.SubMappings.OfType <IdMapping>().First().Property; this.foreignRelationshipMapping = new ReverseForeignRelationshipMapping(Property, type, parentType, foreignKey, formatter); masterMap.For(type).Map(mapping => mapping.MapForeignRelationship(masterMap, Property, type, formatter)); }
public ListMapping(PropertyInfo property, Type type, ReverseForeignRelationshipMapping foreignRelationshipMapping) : base(property) { this.type = type; this.foreignRelationshipMapping = foreignRelationshipMapping; }