Export (0) Print
Expand All

KeyAttribute Class

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Specifies one or more entity properties to use as the unique identity for the entity.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, 
	Inherited = true)]
public sealed class KeyAttribute : Attribute

You apply the KeyAttribute attribute to one or more properties to specify the values that uniquely identify the entity object.

System.Object
  System.Attribute
    System.ComponentModel.DataAnnotations.KeyAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft