Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / ComponentModel / LicenseProviderAttribute.cs / 1 / LicenseProviderAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Security.Permissions;
///
/// Specifies the
/// to use with a class.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class LicenseProviderAttribute : Attribute {
///
///
/// Specifies the default value, which is no provider. This field is read-only.
///
///
public static readonly LicenseProviderAttribute Default = new LicenseProviderAttribute();
private Type licenseProviderType = null;
private string licenseProviderName = null;
///
/// Initializes a new instance of the class without a license
/// provider.
///
public LicenseProviderAttribute() : this((string)null) {
}
///
///
/// Initializes a new instance of the class with
/// the specified type.
///
///
public LicenseProviderAttribute(string typeName) {
licenseProviderName = typeName;
}
///
///
/// Initializes a new instance of the class with
/// the specified type of license provider.
///
///
public LicenseProviderAttribute(Type type) {
licenseProviderType = type;
}
///
/// Gets the license provider to use with the associated class.
///
public Type LicenseProvider {
// SECREVIEW: Remove this attribute once bug#411910 is fixed.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2113:SecureLateBindingMethods")]
get {
if (licenseProviderType == null && licenseProviderName != null) {
licenseProviderType = Type.GetType(licenseProviderName);
}
return licenseProviderType;
}
}
///
///
///
/// This defines a unique ID for this attribute type. It is used
/// by filtering algorithms to identify two attributes that are
/// the same type. For most attributes, this just returns the
/// Type instance for the attribute. LicenseProviderAttribute overrides this to include the type name and the
/// provider type name.
///
///
public override object TypeId {
get {
string typeName = licenseProviderName;
if (typeName == null && licenseProviderType != null) {
typeName = licenseProviderType.FullName;
}
return GetType().FullName + typeName;
}
}
///
///
///
public override bool Equals(object value) {
if (value is LicenseProviderAttribute && value != null) {
Type type = ((LicenseProviderAttribute)value).LicenseProvider;
if (type == LicenseProvider) {
return true;
}
else {
if (type != null && type.Equals(LicenseProvider)) {
return true;
}
}
}
return false;
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Security.Permissions;
///
/// Specifies the
/// to use with a class.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class LicenseProviderAttribute : Attribute {
///
///
/// Specifies the default value, which is no provider. This field is read-only.
///
///
public static readonly LicenseProviderAttribute Default = new LicenseProviderAttribute();
private Type licenseProviderType = null;
private string licenseProviderName = null;
///
/// Initializes a new instance of the class without a license
/// provider.
///
public LicenseProviderAttribute() : this((string)null) {
}
///
///
/// Initializes a new instance of the class with
/// the specified type.
///
///
public LicenseProviderAttribute(string typeName) {
licenseProviderName = typeName;
}
///
///
/// Initializes a new instance of the class with
/// the specified type of license provider.
///
///
public LicenseProviderAttribute(Type type) {
licenseProviderType = type;
}
///
/// Gets the license provider to use with the associated class.
///
public Type LicenseProvider {
// SECREVIEW: Remove this attribute once bug#411910 is fixed.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2113:SecureLateBindingMethods")]
get {
if (licenseProviderType == null && licenseProviderName != null) {
licenseProviderType = Type.GetType(licenseProviderName);
}
return licenseProviderType;
}
}
///
///
///
/// This defines a unique ID for this attribute type. It is used
/// by filtering algorithms to identify two attributes that are
/// the same type. For most attributes, this just returns the
/// Type instance for the attribute. LicenseProviderAttribute overrides this to include the type name and the
/// provider type name.
///
///
public override object TypeId {
get {
string typeName = licenseProviderName;
if (typeName == null && licenseProviderType != null) {
typeName = licenseProviderType.FullName;
}
return GetType().FullName + typeName;
}
}
///
///
///
public override bool Equals(object value) {
if (value is LicenseProviderAttribute && value != null) {
Type type = ((LicenseProviderAttribute)value).LicenseProvider;
if (type == LicenseProvider) {
return true;
}
else {
if (type != null && type.Equals(LicenseProvider)) {
return true;
}
}
}
return false;
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
}
}
// 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
- BrowserInteropHelper.cs
- EdmTypeAttribute.cs
- SchemaLookupTable.cs
- LogArchiveSnapshot.cs
- ListSortDescription.cs
- ExtractedStateEntry.cs
- NameValueConfigurationElement.cs
- WebPartHeaderCloseVerb.cs
- ClientBuildManagerCallback.cs
- HyperLinkField.cs
- InvalidFilterCriteriaException.cs
- Variable.cs
- ByteAnimationBase.cs
- Canvas.cs
- BoundPropertyEntry.cs
- OleDbException.cs
- GetPageNumberCompletedEventArgs.cs
- DataGridParentRows.cs
- ListViewItem.cs
- ProfilePropertyMetadata.cs
- ColumnWidthChangedEvent.cs
- WebPartTracker.cs
- QilVisitor.cs
- AdministrationHelpers.cs
- AssociationProvider.cs
- Vector3DCollectionConverter.cs
- TagMapCollection.cs
- HttpCapabilitiesSectionHandler.cs
- XmlEncodedRawTextWriter.cs
- StretchValidation.cs
- SqlProviderServices.cs
- SimpleFileLog.cs
- ForEachAction.cs
- ApplicationHost.cs
- XmlAttributeHolder.cs
- File.cs
- FixedSOMContainer.cs
- ObjectTypeMapping.cs
- ExcludePathInfo.cs
- StorageComplexPropertyMapping.cs
- formatter.cs
- OutOfMemoryException.cs
- SerializationInfoEnumerator.cs
- ToolStripItemCollection.cs
- shaperfactory.cs
- basenumberconverter.cs
- DataGridViewRowPostPaintEventArgs.cs
- CircleHotSpot.cs
- TriggerCollection.cs
- CollectionViewGroupInternal.cs
- PointCollectionConverter.cs
- Util.cs
- ValueProviderWrapper.cs
- MimeMapping.cs
- SoapExtensionTypeElement.cs
- UnsafeNativeMethods.cs
- CachingHintValidation.cs
- HtmlTableCellCollection.cs
- XmlLanguageConverter.cs
- SemaphoreFullException.cs
- SoapInteropTypes.cs
- UnsafeNativeMethods.cs
- RectAnimationUsingKeyFrames.cs
- FontConverter.cs
- InteropAutomationProvider.cs
- TemplateField.cs
- COM2IDispatchConverter.cs
- Point3DAnimationBase.cs
- UnhandledExceptionEventArgs.cs
- ConditionalAttribute.cs
- PolyQuadraticBezierSegment.cs
- NativeMethods.cs
- XmlSchemaAnnotated.cs
- FileCodeGroup.cs
- SafeCryptContextHandle.cs
- WebConfigurationHostFileChange.cs
- ConnectionManager.cs
- ConnectionStringsExpressionBuilder.cs
- ProtocolsConfiguration.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ExceptionHandlerDesigner.cs
- Int32CollectionConverter.cs
- CompositeKey.cs
- LinqDataSourceHelper.cs
- SettingsPropertyCollection.cs
- MatrixIndependentAnimationStorage.cs
- ObsoleteAttribute.cs
- ScrollEventArgs.cs
- PeerInvitationResponse.cs
- HwndSource.cs
- SelectiveScrollingGrid.cs
- TableItemPattern.cs
- DataTrigger.cs
- DispatcherTimer.cs
- OdbcFactory.cs
- SystemParameters.cs
- WorkflowInstanceAbortedRecord.cs
- PassportIdentity.cs
- QueryGeneratorBase.cs
- ReflectionHelper.cs