Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / DataServiceKeyAttribute.cs / 1305376 / DataServiceKeyAttribute.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Clr Attribute to be annotated on key properties
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Common
{
using System;
using System.Collections.ObjectModel;
using System.Data.Services.Client;
using System.Linq;
///
/// Attribute to be annotated on key properties
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification = "Accessors are available for processed input.")]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class DataServiceKeyAttribute : System.Attribute
{
/// Name of the properties that form the key.
private readonly ReadOnlyCollection keyNames;
///
/// Initializes a new instance of DataServiceKey attribute with the property name
/// that forms the Key.
///
/// Name of the property that form the key for the current type.
public DataServiceKeyAttribute(string keyName)
{
Util.CheckArgumentNull(keyName, "keyName");
Util.CheckArgumentNotEmpty(keyName, "KeyName");
this.keyNames = new ReadOnlyCollection(new string[1] { keyName });
}
///
/// Initializes a new instance of DataServiceKey attribute with the list of property names
/// that form the key.
///
/// Name of the properties that form the key for the current type.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "parameters are validated against null via CheckArgumentNull")]
public DataServiceKeyAttribute(params string[] keyNames)
{
Util.CheckArgumentNull(keyNames, "keyNames");
if (keyNames.Length == 0 || keyNames.Any(f => f == null || f.Length == 0))
{
throw Error.Argument(Strings.DSKAttribute_MustSpecifyAtleastOnePropertyName, "keyNames");
}
this.keyNames = new ReadOnlyCollection(keyNames);
}
/// Name of the properties that form the key for the current type.
public ReadOnlyCollection KeyNames
{
get
{
return this.keyNames;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Clr Attribute to be annotated on key properties
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
namespace System.Data.Services.Common
{
using System;
using System.Collections.ObjectModel;
using System.Data.Services.Client;
using System.Linq;
///
/// Attribute to be annotated on key properties
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification = "Accessors are available for processed input.")]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class DataServiceKeyAttribute : System.Attribute
{
/// Name of the properties that form the key.
private readonly ReadOnlyCollection keyNames;
///
/// Initializes a new instance of DataServiceKey attribute with the property name
/// that forms the Key.
///
/// Name of the property that form the key for the current type.
public DataServiceKeyAttribute(string keyName)
{
Util.CheckArgumentNull(keyName, "keyName");
Util.CheckArgumentNotEmpty(keyName, "KeyName");
this.keyNames = new ReadOnlyCollection(new string[1] { keyName });
}
///
/// Initializes a new instance of DataServiceKey attribute with the list of property names
/// that form the key.
///
/// Name of the properties that form the key for the current type.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "parameters are validated against null via CheckArgumentNull")]
public DataServiceKeyAttribute(params string[] keyNames)
{
Util.CheckArgumentNull(keyNames, "keyNames");
if (keyNames.Length == 0 || keyNames.Any(f => f == null || f.Length == 0))
{
throw Error.Argument(Strings.DSKAttribute_MustSpecifyAtleastOnePropertyName, "keyNames");
}
this.keyNames = new ReadOnlyCollection(keyNames);
}
/// Name of the properties that form the key for the current type.
public ReadOnlyCollection KeyNames
{
get
{
return this.keyNames;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ApplicationHost.cs
- DataGridViewUtilities.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ToolStripRenderer.cs
- TypeUtil.cs
- NavigationService.cs
- WindowsScroll.cs
- SizeAnimationClockResource.cs
- DateTimeStorage.cs
- DropSource.cs
- ColumnBinding.cs
- glyphs.cs
- ResourceWriter.cs
- AttributeCollection.cs
- Iis7Helper.cs
- TextServicesManager.cs
- ThaiBuddhistCalendar.cs
- PolicyStatement.cs
- GenerateTemporaryAssemblyTask.cs
- _ListenerAsyncResult.cs
- JoinTreeNode.cs
- PersonalizationAdministration.cs
- DataKey.cs
- ActionMismatchAddressingException.cs
- Frame.cs
- FamilyTypeface.cs
- ExecutedRoutedEventArgs.cs
- CodeTypeDelegate.cs
- AuthenticationModulesSection.cs
- Comparer.cs
- OleDbEnumerator.cs
- ResolveInfo.cs
- ImageIndexConverter.cs
- GetCertificateRequest.cs
- PropertyGrid.cs
- WebConfigurationHost.cs
- ReferenceSchema.cs
- ToolStripComboBox.cs
- Events.cs
- BinaryMethodMessage.cs
- UnmanagedHandle.cs
- cookie.cs
- SimpleBitVector32.cs
- VectorValueSerializer.cs
- XmlnsPrefixAttribute.cs
- DynamicPropertyHolder.cs
- ImageCodecInfoPrivate.cs
- PreProcessInputEventArgs.cs
- Mouse.cs
- HttpHeaderCollection.cs
- ClientUrlResolverWrapper.cs
- SystemResourceKey.cs
- DataGridViewControlCollection.cs
- IIS7UserPrincipal.cs
- Trigger.cs
- ListViewInsertEventArgs.cs
- CompilerError.cs
- DataList.cs
- ExternalFile.cs
- DBSchemaTable.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- QilVisitor.cs
- DbConnectionPoolGroupProviderInfo.cs
- MessageDescription.cs
- GetPageCompletedEventArgs.cs
- DynamicPropertyHolder.cs
- PathGradientBrush.cs
- WindowsProgressbar.cs
- BindingNavigator.cs
- PreloadHost.cs
- InstanceContext.cs
- ReadWriteControlDesigner.cs
- securestring.cs
- GenericRootAutomationPeer.cs
- BindingContext.cs
- TypeTypeConverter.cs
- StructuralCache.cs
- ReferentialConstraint.cs
- AccessText.cs
- CommandField.cs
- Activity.cs
- XmlSchemaSimpleContentExtension.cs
- PersonalizableAttribute.cs
- XmlSchemaSet.cs
- TableParagraph.cs
- DescriptionAttribute.cs
- SafeIUnknown.cs
- WeakReadOnlyCollection.cs
- ObjectToken.cs
- TrimSurroundingWhitespaceAttribute.cs
- ValueTable.cs
- SqlBuilder.cs
- DBConcurrencyException.cs
- StringCollectionEditor.cs
- SourceItem.cs
- IndexOutOfRangeException.cs
- ManagementPath.cs
- WebBrowser.cs
- TreeViewItemAutomationPeer.cs
- WebUtil.cs