public INodeMappingExpression <TDestination> CustomProperty( Expression <Func <TDestination, object> > destinationProperty, CustomPropertyMapping mapping, bool requiresInclude, bool allowCaching ) { if (destinationProperty == null) { throw new ArgumentNullException("destinationProperty"); } else if (mapping == null) { throw new ArgumentNullException("mapping"); } var mapper = new CustomPropertyMapper( mapping, requiresInclude, allowCaching, _nodeMapper, destinationProperty.GetPropertyInfo() ); _nodeMapper.InsertPropertyMapper(mapper); return(this); }
public INodeMappingExpression <TDestination> ForProperty <TProperty>( Expression <Func <TDestination, TProperty> > destinationProperty, Func <Node, string[], object> propertyMapping, bool requiresInclude ) { if (destinationProperty == null) { throw new ArgumentNullException("destinationProperty"); } else if (propertyMapping == null) { throw new ArgumentNullException("propertyMapping"); } CustomPropertyMapping mapping = (id, paths, cache) => { var node = new Node(id); if (string.IsNullOrEmpty(node.Name)) { return(null); } return(propertyMapping(node, paths)); }; var mapper = new CustomPropertyMapper( mapping, requiresInclude, false, _nodeMapper, destinationProperty.GetPropertyInfo() ); _nodeMapper.InsertPropertyMapper(mapper); return(this); }