Share via


EntityTypeConfiguration<TEntityType>.HasRequired<TTargetEntity> Method

Configures a required 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 HasRequired(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.HasRequired(navigationPropertyExpression)
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 : 
        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 =&gt; 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.

See Also

Reference

EntityTypeConfiguration<TEntityType> Class

System.Web.Http.OData.Builder Namespace