EntityTypeConfiguration<TEntityType>.HasOptional<TTargetEntity> Method
Configures an optional relationship from this entity type.
Namespace: System.Web.Http.OData.Builder
Assembly: System.Web.Http.OData (in System.Web.Http.OData.dll)
Syntax
'Declaration
Public Function HasOptional(Of TTargetEntity As Class) ( _
navigationPropertyExpression As Expression(Of Func(Of TEntityType, TTargetEntity)) _
) As NavigationPropertyConfiguration
'Usage
Dim instance As EntityTypeConfiguration
Dim navigationPropertyExpression As Expression(Of Func(Of TEntityType, TTargetEntity))
Dim returnValue As NavigationPropertyConfiguration
returnValue = instance.HasOptional(navigationPropertyExpression)
public NavigationPropertyConfiguration HasOptional<TTargetEntity>(
Expression<Func<TEntityType, TTargetEntity>> navigationPropertyExpression
)
where TTargetEntity : class
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class
NavigationPropertyConfiguration^ HasOptional(
Expression<Func<TEntityType, TTargetEntity>^>^ navigationPropertyExpression
)
member HasOptional :
navigationPropertyExpression:Expression<Func<'TEntityType, 'TTargetEntity>> -> NavigationPropertyConfiguration when 'TTargetEntity : not struct
JScript does not support generic types and methods.
Type Parameters
- TTargetEntity
The type of the entity at the other end of the relationship.
Parameters
- navigationPropertyExpression
Type: System.Linq.Expressions.Expression<Func<TEntityType, TTargetEntity>>
A lambda expression representing the navigation property for the relationship. For example, in C# t => t.MyProperty and in Visual Basic .NET Function(t) t.MyProperty .
Return Value
Type: System.Web.Http.OData.Builder.NavigationPropertyConfiguration
A configuration object that can be used to further configure the relationship.