次の方法で共有


ConventionTypeConfiguration<T>.HasKey<TProperty> メソッド

定義

このエンティティ型の主キー プロパティを構成します。

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration<T> HasKey<TProperty>(System.Linq.Expressions.Expression<Func<T,TProperty>> keyExpression);
member this.HasKey : System.Linq.Expressions.Expression<Func<'T, 'Property>> -> System.Data.Entity.ModelConfiguration.Configuration.ConventionTypeConfiguration<'T (requires 'T : null)>
Public Function HasKey(Of TProperty) (keyExpression As Expression(Of Func(Of T, TProperty))) As ConventionTypeConfiguration(Of T)

型パラメーター

TProperty

キーの型。

パラメーター

keyExpression
Expression<Func<T,TProperty>>

プライマリ キーとして使用されるプロパティを表すラムダ式。 C#: t => t.Id VB.Net: Function(t) t.Id 主キーが複数のプロパティで構成されている場合は、プロパティを含む匿名型を指定します。 C#: t => new { t.Id1, t.Id2 } VB.Net: Function(t) New With { t.Id1, t.Id2 }

戻り値

複数の呼び出しをチェーンできるように、同じ ConventionTypeConfiguration<T> インスタンス。

属性

注釈

これを呼び出しても、構成後は効果がありません。

適用対象