EntityTypeConfiguration<TEntityType>.HasRequired Method
Namespace: System.Web.OData.Builder
Assembly: System.Web.OData (in System.Web.OData.dll)
Overload List
Name | Description | |
---|---|---|
HasRequired<TTargetEntity>(Expression<Func<TEntityType, TTargetEntity>>) | Configures a required relationship from this entity type. |
|
HasRequired<TTargetEntity>(Expression<Func<TEntityType, TTargetEntity>>, Expression<Func<TEntityType, TTargetEntity, Boolean>>) | Configures a required relationship with referential constraint from this entity type. |
See Also
EntityTypeConfiguration<TEntityType> Class
System.Web.OData.Builder Namespace
Return to top
EntityTypeConfiguration<TEntityType>.HasRequired<TTargetEntity> Method (Expression<Func<TEntityType, TTargetEntity>>)
Configures a required relationship from this entity type.
Syntax
public NavigationPropertyConfiguration HasRequired<TTargetEntity>(
Expression<Func<TEntityType, TTargetEntity>> navigationPropertyExpression
)
where TTargetEntity : class
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class
NavigationPropertyConfiguration^ HasRequired(
Expression<Func<TEntityType, TTargetEntity>^>^ navigationPropertyExpression
)
member HasRequired<'TTargetEntity when 'TTargetEntity : not struct> :
navigationPropertyExpression:Expression<Func<'TEntityType, 'TTargetEntity>> -> NavigationPropertyConfiguration
Public Function HasRequired(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.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>.HasRequired<TTargetEntity> Method (Expression<Func<TEntityType, TTargetEntity>>, Expression<Func<TEntityType, TTargetEntity, Boolean>>)
Configures a required relationship with referential constraint from this entity type.
Syntax
public NavigationPropertyConfiguration HasRequired<TTargetEntity>(
Expression<Func<TEntityType, TTargetEntity>> navigationPropertyExpression,
Expression<Func<TEntityType, TTargetEntity, bool>> referentialConstraintExpression
)
where TTargetEntity : class
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class
NavigationPropertyConfiguration^ HasRequired(
Expression<Func<TEntityType, TTargetEntity>^>^ navigationPropertyExpression,
Expression<Func<TEntityType, TTargetEntity, bool>^>^ referentialConstraintExpression
)
member HasRequired<'TTargetEntity when 'TTargetEntity : not struct> :
navigationPropertyExpression:Expression<Func<'TEntityType, 'TTargetEntity>> *
referentialConstraintExpression:Expression<Func<'TEntityType, 'TTargetEntity, bool>> -> NavigationPropertyConfiguration
Public Function HasRequired(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.Customer.
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) c.CustomerId == c.Id.
Return Value
Type: System.Web.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