Sdílet prostřednictvím


EntityTypeConfiguration<TEntityType>.HasRequired<TTargetEntity> Metoda

Definice

Nakonfiguruje požadovanou relaci z tohoto typu entity. Instance typu entity nebude možné uložit do databáze, pokud není tato relace zadána. Cizí klíč v databázi nebude mít hodnotu null.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public System.Data.Entity.ModelConfiguration.Configuration.RequiredNavigationPropertyConfiguration<TEntityType,TTargetEntity> HasRequired<TTargetEntity> (System.Linq.Expressions.Expression<Func<TEntityType,TTargetEntity>> navigationPropertyExpression) where TTargetEntity : class;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Data.Entity.ModelConfiguration.Configuration.RequiredNavigationPropertyConfiguration<TEntityType,TTargetEntity> HasRequired<TTargetEntity> (System.Linq.Expressions.Expression<Func<TEntityType,TTargetEntity>> navigationPropertyExpression) where TTargetEntity : class;
member this.HasRequired : System.Linq.Expressions.Expression<Func<'EntityType, 'argetEntity>> -> System.Data.Entity.ModelConfiguration.Configuration.RequiredNavigationPropertyConfiguration<'EntityType, 'argetEntity (requires 'EntityType : null and 'argetEntity : null)> (requires 'argetEntity : null)
Public Function HasRequired(Of TTargetEntity As Class) (navigationPropertyExpression As Expression(Of Func(Of TEntityType, TTargetEntity))) As RequiredNavigationPropertyConfiguration(Of TEntityType, TTargetEntity)

Parametry typu

TTargetEntity

Typ entity na druhém konci relace.

Parametry

navigationPropertyExpression
Expression<Func<TEntityType,TTargetEntity>>

Výraz lambda představující vlastnost navigace pro relaci. C#: t => t.MyProperty VB.Net: Function(t) t.MyProperty

Návraty

RequiredNavigationPropertyConfiguration<TEntityType,TTargetEntity>

Objekt konfigurace, který lze použít k další konfiguraci relace.

Atributy

Platí pro