OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalPrincipal Method

 

Configures the relationship to be optional:optional. The entity type being configured will be the principal in the relationship. The entity type that the relationship targets will be the dependent and contain a foreign key to the principal.

Namespace:   System.Data.Entity.ModelConfiguration.Configuration
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodWithOptionalPrincipal()

Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. The entity type being configured will be the principal in the relationship. The entity type that the relationship targets will be the dependent and contain a foreign key to the principal.

System_CAPS_pubmethodWithOptionalPrincipal(Expression<Func<TTargetEntityType, TEntityType>>)

Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. The entity type being configured will be the principal in the relationship. The entity type that the relationship targets will be the dependent and contain a foreign key to the principal.


OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalPrincipal Method ()

Configures the relationship to be optional:optional without a navigation property on the other side of the relationship. The entity type being configured will be the principal in the relationship. The entity type that the relationship targets will be the dependent and contain a foreign key to the principal.

public ForeignKeyNavigationPropertyConfiguration WithOptionalPrincipal()

Return Value

Type: System.Data.Entity.ModelConfiguration.Configuration.ForeignKeyNavigationPropertyConfiguration

A configuration object that can be used to further configure the relationship.


OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalPrincipal Method (Expression<Func<TTargetEntityType, TEntityType>>)

Configures the relationship to be optional:optional with a navigation property on the other side of the relationship. The entity type being configured will be the principal in the relationship. The entity type that the relationship targets will be the dependent and contain a foreign key to the principal.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public ForeignKeyNavigationPropertyConfiguration WithOptionalPrincipal(
	Expression<Func<TTargetEntityType, TEntityType>> navigationPropertyExpression
)

Parameters

navigationPropertyExpression
Type: System.Linq.Expressions.Expression<Func<TTargetEntityType, TEntityType>>

A lambda expression representing the navigation property on the other end of the relationship.

Return Value

Type: System.Data.Entity.ModelConfiguration.Configuration.ForeignKeyNavigationPropertyConfiguration

A configuration object that can be used to further configure the relationship.