public NavigationPropertyBindingConfiguration HasOptionalBinding <TTargetType, TDerivedEntityType>( Expression <Func <TDerivedEntityType, 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>(); NavigationPropertyConfiguration navigation = derivedEntityType.HasOptional(navigationExpression); IList <object> bindingPath = new List <object> { typeof(TDerivedEntityType), navigation.PropertyInfo }; return(this.Configuration.AddBinding(navigation, targetEntitySet.Configuration, bindingPath)); }
public NavigationPropertyBindingConfiguration HasOptionalBinding <TTargetType, TDerivedEntityType>( Expression <Func <TDerivedEntityType, 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.HasOptional(navigationExpression), _modelBuilder.EntitySet <TTargetType>(entitySetName).Configuration)); }
public NavigationPropertyBindingConfiguration HasOptionalBinding <TTargetType, TDerivedEntityType>( Expression <Func <TDerivedEntityType, 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.HasOptional(navigationExpression), targetEntitySet.Configuration)); }