public INodeMappingExpression <TDestination> CollectionProperty <TSourceProperty>( Expression <Func <TDestination, object> > destinationProperty, CollectionPropertyMapping <TSourceProperty> mapping, string propertyAlias = null ) { if (mapping == null) { throw new ArgumentNullException("mapping"); } var mapper = new CollectionPropertyMapper( (context, value) => mapping((TSourceProperty)value), typeof(TSourceProperty), _nodeMapper, destinationProperty.GetPropertyInfo(), propertyAlias ); _nodeMapper.InsertPropertyMapper(mapper); return(this); }
public IPropertyMapping GetPropertyMapping(string propertyName) { CheckInitialized(); if (_queryableCollection == null) { // Not a collection? return((IPropertyMapping)_persister); // Return the entity property mapping. } // If the property is a special collection property name, return a CollectionPropertyMapping. if (CollectionProperties.IsCollectionProperty(propertyName)) { if (_collectionPropertyMapping == null) { _collectionPropertyMapping = new CollectionPropertyMapping(_queryableCollection); } return(_collectionPropertyMapping); } if (_queryableCollection.ElementType.IsAnyType) { // collection of <many-to-any/> mappings... // used to circumvent the component-collection check below... return(_queryableCollection); } if (_queryableCollection.ElementType.IsComponentType) { // Collection of components. if (propertyName == Persister.Entity.EntityPersister.EntityID) { return((IPropertyMapping)_queryableCollection.OwnerEntityPersister); } } return(_queryableCollection); }