EntityTypeConfiguration<TEntityType>.HasOptional Method
Namespace: System.Web.Http.OData.Builder
Assembly: System.Web.Http.OData (in System.Web.Http.OData.dll)
Overload List
Name | Description | |
---|---|---|
HasOptional<TTargetEntity>(Expression<Func<TEntityType, TTargetEntity>>) | Configures an optional relationship from this entity type. |
|
HasOptional<TTargetEntity>(Expression<Func<TEntityType, TTargetEntity>>, Expression<Func<TEntityType, TTargetEntity, Boolean>>) | Configures an optional relationship with referential constraint from this entity type. |
See Also
EntityTypeConfiguration<TEntityType> Class
System.Web.Http.OData.Builder Namespace
Return to top
EntityTypeConfiguration<TEntityType>.HasOptional<TTargetEntity> Method (Expression<Func<TEntityType, TTargetEntity>>)
Configures an optional relationship from this entity type.
Syntax
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<'TTargetEntity when 'TTargetEntity : not struct> :
navigationPropertyExpression:Expression<Func<'TEntityType, 'TTargetEntity>> -> NavigationPropertyConfiguration
Public Function HasOptional(Of TTargetEntity As Class) (
navigationPropertyExpression As Expression(Of Func(Of TEntityType, TTargetEntity))
) As NavigationPropertyConfiguration
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.
Type Parameters
- TTargetEntity
The type of the entity at the other end of the relationship.
Return to top
EntityTypeConfiguration<TEntityType>.HasOptional<TTargetEntity> Method (Expression<Func<TEntityType, TTargetEntity>>, Expression<Func<TEntityType, TTargetEntity, Boolean>>)
Configures an optional relationship with referential constraint from this entity type.
Syntax
public NavigationPropertyConfiguration HasOptional<TTargetEntity>(
Expression<Func<TEntityType, TTargetEntity>> navigationPropertyExpression,
Expression<Func<TEntityType, TTargetEntity, bool>> referentialConstraintExpression
)
where TTargetEntity : class
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class
NavigationPropertyConfiguration^ HasOptional(
Expression<Func<TEntityType, TTargetEntity>^>^ navigationPropertyExpression,
Expression<Func<TEntityType, TTargetEntity, bool>^>^ referentialConstraintExpression
)
member HasOptional<'TTargetEntity when 'TTargetEntity : not struct> :
navigationPropertyExpression:Expression<Func<'TEntityType, 'TTargetEntity>> *
referentialConstraintExpression:Expression<Func<'TEntityType, 'TTargetEntity, bool>> -> NavigationPropertyConfiguration
Public Function HasOptional(Of TTargetEntity As Class) (
navigationPropertyExpression As Expression(Of Func(Of TEntityType, TTargetEntity)),
referentialConstraintExpression As Expression(Of Func(Of TEntityType, TTargetEntity, Boolean))
) As NavigationPropertyConfiguration
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.Customer and in Visual Basic .NET Function(t) t.Cusomter.
referentialConstraintExpression
Type: System.Linq.Expressions.Expression<Func<TEntityType, TTargetEntity, Boolean>>A lambda expression representing the referential constraint. For example, in C# (o, c) => o.CustomerId == c.Id and in Visual Basic .NET Function(o, c) o.CustomerId == c.Id.
Return Value
Type: System.Web.Http.OData.Builder.NavigationPropertyConfiguration
A configuration object that can be used to further configure the relationship.
Type Parameters
- TTargetEntity
The type of the entity at the other end of the relationship.
Return to top