OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalDependent Method

 

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

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

NameDescription
System_CAPS_pubmethodWithOptionalDependent()

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 dependent and contain a foreign key to the principal. The entity type that the relationship targets will be the principal in the relationship.

System_CAPS_pubmethodWithOptionalDependent(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 dependent and contain a foreign key to the principal. The entity type that the relationship targets will be the principal in the relationship.


OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalDependent 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 dependent and contain a foreign key to the principal. The entity type that the relationship targets will be the principal in the relationship.

public ForeignKeyNavigationPropertyConfiguration WithOptionalDependent()

Return Value

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

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


OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptionalDependent 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 dependent and contain a foreign key to the principal. The entity type that the relationship targets will be the principal in the relationship.

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

Parameters

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

An lambda expression representing the navigation property on the other end of the relationship. C#: t =&gt; t.MyProperty VB.Net: Function(t) t.MyProperty

Return Value

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

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