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
- AttachedAnnotationChangedEventArgs.cs
- SafeFileMappingHandle.cs
- ContentType.cs
- ClientType.cs
- DrawingState.cs
- SHA384CryptoServiceProvider.cs
- RSAPKCS1KeyExchangeFormatter.cs
- OutputCacheSettingsSection.cs
- XmlAttributeCollection.cs
- Rotation3D.cs
- Fonts.cs
- LoadRetryConstantStrategy.cs
- StandardOleMarshalObject.cs
- TypeInitializationException.cs
- LoginStatusDesigner.cs
- CompressionTransform.cs
- _StreamFramer.cs
- ReferencedAssembly.cs
- Update.cs
- TimeSpanOrInfiniteValidator.cs
- InputProcessorProfiles.cs
- ServiceModelStringsVersion1.cs
- SmuggledIUnknown.cs
- UnknownMessageReceivedEventArgs.cs
- ApplicationActivator.cs
- DbDataReader.cs
- SplitterEvent.cs
- InternalDispatchObject.cs
- TextBreakpoint.cs
- MobileUserControlDesigner.cs
- PolyLineSegment.cs
- XmlWrappingWriter.cs
- ServerIdentity.cs
- InternalBufferOverflowException.cs
- TextTreeObjectNode.cs
- BordersPage.cs
- DependencyPropertyValueSerializer.cs
- BinaryObjectWriter.cs
- Typeface.cs
- SafeTokenHandle.cs
- XamlSerializerUtil.cs
- AuthenticationModeHelper.cs
- BindUriHelper.cs
- Formatter.cs
- FontStyleConverter.cs
- Italic.cs
- _ShellExpression.cs
- SafeEventLogWriteHandle.cs
- InfocardInteractiveChannelInitializer.cs
- GPStream.cs
- AggregateException.cs
- ExtendedProtectionPolicyElement.cs
- ServiceCredentialsElement.cs
- LogLogRecordEnumerator.cs
- Button.cs
- EntityStoreSchemaFilterEntry.cs
- HitTestDrawingContextWalker.cs
- WindowsStatic.cs
- XmlSchemaSimpleType.cs
- Font.cs
- DocumentPageHost.cs
- ColorBlend.cs
- GlyphsSerializer.cs
- ImageField.cs
- AudienceUriMode.cs
- METAHEADER.cs
- HtmlAnchor.cs
- XsdBuildProvider.cs
- ValidatedControlConverter.cs
- TextElementAutomationPeer.cs
- Header.cs
- PersonalizationState.cs
- LocalizationCodeDomSerializer.cs
- HostedTransportConfigurationBase.cs
- InkCanvasInnerCanvas.cs
- FixUp.cs
- SslStream.cs
- TextRangeEditLists.cs
- BamlWriter.cs
- HttpListenerPrefixCollection.cs
- NumberFormatInfo.cs
- PageContentAsyncResult.cs
- SqlTypeConverter.cs
- SimpleRecyclingCache.cs
- EventProvider.cs
- Evidence.cs
- OdbcConnectionFactory.cs
- DiffuseMaterial.cs
- EnumerableRowCollection.cs
- WebBrowserNavigatingEventHandler.cs
- CompilerGeneratedAttribute.cs
- _FixedSizeReader.cs
- PropertyTabChangedEvent.cs
- PolyLineSegment.cs
- FrameworkTextComposition.cs
- BindingGraph.cs
- BindingWorker.cs
- RegexRunner.cs
- CustomAttributeFormatException.cs
- QueryOpeningEnumerator.cs