예제 #1
0
        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);
        }
예제 #2
0
        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);
        }