public ICollectionPropertyBuilder <TProperty> HasMany <TProperty>(Expression <Func <TEntity, TProperty> > property) { string propertyName = PropertyNameExtractor.Extract(property); ICollectionPropertyBuilder <TProperty> propertyBuilder = this.HasMany(propertyName) as ICollectionPropertyBuilder <TProperty>; return(propertyBuilder); }
public ICollectionPropertyBuilder HasMany(string property) { CollectionProperty collectionProperty = this.EntityType.CollectionProperties.Where(a => a.Property.Name == property).FirstOrDefault(); if (collectionProperty == null) { PropertyInfo propertyInfo = this.GetEntityProperty(property); collectionProperty = new CollectionProperty(propertyInfo); this.EntityType.CollectionProperties.Add(collectionProperty); } ICollectionPropertyBuilder propertyBuilder = Activator.CreateInstance(typeof(CollectionPropertyBuilder <>).MakeGenericType(collectionProperty.Property.PropertyType), collectionProperty) as ICollectionPropertyBuilder; return(propertyBuilder); }