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>(); NavigationPropertyConfiguration navigation = derivedEntityType.HasMany(navigationExpression); IList <object> bindingPath = new List <object> { typeof(TDerivedEntityType), navigation.PropertyInfo }; return(this.Configuration.AddBinding(navigation, _modelBuilder.EntitySet <TTargetType>(entitySetName)._configuration, bindingPath)); }
public NavigationPropertyBindingConfiguration HasManyBinding <TTargetType, TDerivedEntityType>( Expression <Func <TDerivedEntityType, IEnumerable <TTargetType> > > navigationExpression, NavigationSourceConfiguration <TTargetType> targetEntitySet) where TTargetType : class where TDerivedEntityType : class, TEntityType { if (navigationExpression == null) { throw Error.ArgumentNull("navigationExpression"); } if (targetEntitySet == null) { throw Error.ArgumentNull("targetEntitySet"); } EntityTypeConfiguration <TDerivedEntityType> derivedEntityType = _modelBuilder.EntityType <TDerivedEntityType>().DerivesFrom <TEntityType>(); return(this.Configuration.AddBinding(derivedEntityType.HasMany(navigationExpression), targetEntitySet.Configuration)); }