public void Map(ClassMappingBase classMap, Member property) { var mapping = new ComponentMapping { Name = property.Name, Member = property, ContainingEntityType = classMap.Type, Type = property.PropertyType }; mapper.FlagAsMapped(property.PropertyType); mapper.MergeMap(property.PropertyType, mapping, new List <string>()); classMap.AddComponent(mapping); }
public ExternalComponentMapping Resolve(ComponentResolutionContext context, IEnumerable <IExternalComponentMappingProvider> componentProviders) { // this will only be called if there was no ComponentMap found var mapping = new ExternalComponentMapping(ComponentType.Component) { Member = context.ComponentMember, ContainingEntityType = context.EntityType, }; mapping.Set(x => x.Name, Layer.Defaults, context.ComponentMember.Name); mapping.Set(x => x.Type, Layer.Defaults, context.ComponentType); if (context.ComponentMember.IsProperty && !context.ComponentMember.CanWrite) { mapping.Set(x => x.Access, Layer.Defaults, cfg.GetAccessStrategyForReadOnlyProperty(context.ComponentMember).ToString()); } mapper.FlagAsMapped(context.ComponentType); mapper.MergeMap(context.ComponentType, mapping, new List <Member>()); return(mapping); }