RequiredNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptional Method

 

Configures the relationship to be required: optional without a navigation property on the other side of the relationship.

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

NameDescription
System_CAPS_pubmethodWithOptional()

Configures the relationship to be required:optional without a navigation property on the other side of the relationship.

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

Configures the relationship to be required:optional with a navigation property on the other side of the relationship.


RequiredNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptional Method ()

Configures the relationship to be required:optional without a navigation property on the other side of the relationship.

public ForeignKeyNavigationPropertyConfiguration WithOptional()

Return Value

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

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


RequiredNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithOptional Method (Expression<Func<TTargetEntityType, TEntityType>>)

Configures the relationship to be required:optional with a navigation property on the other side of the relationship.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public ForeignKeyNavigationPropertyConfiguration WithOptional(
	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.