Esempio n. 1
0
        public NavigationPropertyBindingConfiguration HasManyBinding <TTargetType, TDerivedEntityType>(
            Expression <Func <TDerivedEntityType, IEnumerable <TTargetType> > > navigationExpression, string entitySetName)
            where TTargetType : class
            where TDerivedEntityType : class, TEntityType
        {
            if (navigationExpression == null)
            {
                throw Error.ArgumentNull("navigationExpression");
            }

            if (String.IsNullOrEmpty(entitySetName))
            {
                throw Error.ArgumentNullOrEmpty("entitySetName");
            }

            EntityTypeConfiguration <TDerivedEntityType> derivedEntityType =
                _modelBuilder.EntityType <TDerivedEntityType>().DerivesFrom <TEntityType>();

            return(this.Configuration.AddBinding(derivedEntityType.HasMany(navigationExpression),
                                                 _modelBuilder.EntitySet <TTargetType>(entitySetName)._configuration));
        }