OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithRequired Method
Configures the specified end of the relationship to be required.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() | WithRequired() | Configures the relationship to be optional:required without a navigation property on the other side of the relationship. |
![]() | WithRequired(Expression<Func<TTargetEntityType, TEntityType>>) | Configures the relationship to be optional:required with a navigation property on the other side of the relationship. |
OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithRequired Method ()
Configures the relationship to be optional:required without a navigation property on the other side of the relationship.
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ForeignKeyNavigationPropertyConfigurationA configuration object that can be used to further configure the relationship.
OptionalNavigationPropertyConfiguration<TEntityType, TTargetEntityType>.WithRequired Method (Expression<Func<TTargetEntityType, TEntityType>>)
Configures the relationship to be optional:required with a navigation property on the other side of the relationship.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] [SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public ForeignKeyNavigationPropertyConfiguration WithRequired( 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 => t.MyProperty VB.Net: Function(t) t.MyProperty
Return Value
Type: System.Data.Entity.ModelConfiguration.Configuration.ForeignKeyNavigationPropertyConfigurationA configuration object that can be used to further configure the relationship.