Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / DataServiceKeyAttribute.cs / 2 / 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.Generic;
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.
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.Generic;
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.
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
- DocumentEventArgs.cs
- ILGenerator.cs
- TextDecorations.cs
- DataListItem.cs
- WindowsToolbarItemAsMenuItem.cs
- ImageSourceConverter.cs
- SqlXmlStorage.cs
- CharStorage.cs
- ButtonFlatAdapter.cs
- SpinWait.cs
- ErasingStroke.cs
- WebPartConnectionsEventArgs.cs
- BufferModeSettings.cs
- Operator.cs
- TypefaceMap.cs
- DataSpaceManager.cs
- EndEvent.cs
- DataGridParentRows.cs
- ImageDrawing.cs
- Error.cs
- PlacementWorkspace.cs
- Stylesheet.cs
- XmlUtil.cs
- CatalogPart.cs
- LinearGradientBrush.cs
- FrameAutomationPeer.cs
- WebSysDescriptionAttribute.cs
- HyperLinkStyle.cs
- HandledEventArgs.cs
- AlignmentYValidation.cs
- TextRenderer.cs
- InfoCardConstants.cs
- LayoutEngine.cs
- SequenceRangeCollection.cs
- WorkflowTransactionOptions.cs
- RSAOAEPKeyExchangeDeformatter.cs
- XsdValidatingReader.cs
- SvcMapFileSerializer.cs
- VSWCFServiceContractGenerator.cs
- MarshalByValueComponent.cs
- OdbcDataAdapter.cs
- BitmapEffectGeneralTransform.cs
- XPathNodeIterator.cs
- _ListenerResponseStream.cs
- XmlEnumAttribute.cs
- SiteMapNodeItemEventArgs.cs
- MDIClient.cs
- XPathAncestorIterator.cs
- XmlSchemaComplexContentExtension.cs
- CaretElement.cs
- IriParsingElement.cs
- SeekStoryboard.cs
- FixedFlowMap.cs
- AsynchronousChannel.cs
- ConditionCollection.cs
- ConfigurationSettings.cs
- Int32Rect.cs
- MULTI_QI.cs
- ActivationServices.cs
- CLSCompliantAttribute.cs
- InternalBufferOverflowException.cs
- Crc32Helper.cs
- EditorPart.cs
- SerializerDescriptor.cs
- UnsafeNativeMethodsTablet.cs
- Debug.cs
- FontStretchConverter.cs
- DataGridViewTopLeftHeaderCell.cs
- PromptBuilder.cs
- ResourcePermissionBase.cs
- CookieProtection.cs
- Cursor.cs
- ProfileBuildProvider.cs
- SqlUdtInfo.cs
- Maps.cs
- AutoGeneratedFieldProperties.cs
- EventTrigger.cs
- KeyValueConfigurationCollection.cs
- XmlDataCollection.cs
- X509RecipientCertificateClientElement.cs
- QuotedStringWriteStateInfo.cs
- TiffBitmapEncoder.cs
- LinqDataSourceContextEventArgs.cs
- WindowsSpinner.cs
- PathFigureCollection.cs
- CodeMemberEvent.cs
- SqlMultiplexer.cs
- User.cs
- NavigationCommands.cs
- SqlProviderServices.cs
- ScopelessEnumAttribute.cs
- Marshal.cs
- HtmlInputCheckBox.cs
- assertwrapper.cs
- AppDomain.cs
- Suspend.cs
- MexNamedPipeBindingCollectionElement.cs
- ClickablePoint.cs
- PageCopyCount.cs
- DataTableExtensions.cs