.NET Framework Class Library
DataServiceKeyAttribute Class

Denotes the key property or properties of an entity.

Namespace:  System.Data.Services.Common
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)
Syntax

Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := False)> _
Public NotInheritable Class DataServiceKeyAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As DataServiceKeyAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)]
public sealed class DataServiceKeyAttribute : Attribute
Visual C++
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = false)]
public ref class DataServiceKeyAttribute sealed : public Attribute
JScript
public final class DataServiceKeyAttribute extends Attribute
Inheritance Hierarchy

System..::.Object
  System..::.Attribute
    System.Data.Services.Common..::.DataServiceKeyAttribute
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5 SP1
See Also

Reference

Tags :


Community Content

DanVladut
Wrong description or bug?
DataServiceKeyAttribute is obviously an attribute that can only be used on a class, but looking at its description and further more from the example provided here:

http://msdn.microsoft.com/en-us/library/cc668799.aspx

one will normally think t it should be a Property attribute, used to mark the key property of a class from the business layer (the example in the article doesn't work, of course).

Luckyly forums cleared out this problem for me, the way to use DataServiceKeyAttribute lays in its constructor where one can pass the name(s) of the property(properties) used as key.


PS. Initially I was asking here how to use DataServiceKeyAttribute.


Page view tracker