Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / DataObjectFieldAttribute.cs / 1 / DataObjectFieldAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Security.Permissions;
///
/// Represents a field of a DataObject. Use this attribute on a field to indicate
/// properties such as primary key, identity, nullability, and length.
///
[AttributeUsage(AttributeTargets.Property)]
public sealed class DataObjectFieldAttribute : Attribute {
private bool _primaryKey;
private bool _isIdentity;
private bool _isNullable;
private int _length;
public DataObjectFieldAttribute(bool primaryKey) : this(primaryKey, false, false, -1) {
}
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity) : this(primaryKey, isIdentity, false, -1) {
}
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable) : this(primaryKey, isIdentity, isNullable, -1){
}
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable, int length) {
_primaryKey = primaryKey;
_isIdentity = isIdentity;
_isNullable = isNullable;
_length = length;
}
public bool IsIdentity {
get {
return _isIdentity;
}
}
public bool IsNullable {
get {
return _isNullable;
}
}
public int Length {
get {
return _length;
}
}
public bool PrimaryKey {
get {
return _primaryKey;
}
}
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
DataObjectFieldAttribute other = obj as DataObjectFieldAttribute;
return (other != null) &&
(other.IsIdentity == IsIdentity) &&
(other.IsNullable == IsNullable) &&
(other.Length == Length) &&
(other.PrimaryKey == PrimaryKey);
}
public override int GetHashCode() {
return base.GetHashCode();
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NativeMethods.cs
- WebServiceMethodData.cs
- CalendarDesigner.cs
- recordstate.cs
- DebugController.cs
- PTManager.cs
- AsymmetricAlgorithm.cs
- PropertiesTab.cs
- SoapObjectInfo.cs
- SqlBooleanizer.cs
- BaseCollection.cs
- CollectionMarkupSerializer.cs
- RichTextBoxDesigner.cs
- TheQuery.cs
- ServiceModelConfigurationSection.cs
- BinaryNode.cs
- ElementProxy.cs
- ReflectTypeDescriptionProvider.cs
- WindowsClaimSet.cs
- BufferModesCollection.cs
- FamilyTypefaceCollection.cs
- WaitHandle.cs
- WorkflowItemsPresenter.cs
- ProfileParameter.cs
- SqlFacetAttribute.cs
- SynchronousChannelMergeEnumerator.cs
- ConnectionInterfaceCollection.cs
- SafeRightsManagementHandle.cs
- BaseValidator.cs
- SqlUDTStorage.cs
- DataGridViewCell.cs
- ECDiffieHellmanCngPublicKey.cs
- MessageSecurityTokenVersion.cs
- SettingsPropertyValueCollection.cs
- TableItemPatternIdentifiers.cs
- AttributeCollection.cs
- BuildProvidersCompiler.cs
- ConditionalBranch.cs
- EventRouteFactory.cs
- OdbcCommand.cs
- ScrollChangedEventArgs.cs
- EmptyStringExpandableObjectConverter.cs
- DataGridHelper.cs
- LoginUtil.cs
- ToolBarButton.cs
- LinqDataSourceHelper.cs
- TypeLoadException.cs
- GraphicsContext.cs
- TimeSpanConverter.cs
- DataList.cs
- OutputCacheProfile.cs
- TemplatePropertyEntry.cs
- SoundPlayer.cs
- TextBlockAutomationPeer.cs
- EventHandlersStore.cs
- ToolZone.cs
- MappingSource.cs
- ExpandCollapseIsCheckedConverter.cs
- ContextStaticAttribute.cs
- ExcCanonicalXml.cs
- ArcSegment.cs
- ColorAnimationUsingKeyFrames.cs
- WindowsAltTab.cs
- TextBox.cs
- OdbcConnectionPoolProviderInfo.cs
- EntitySqlQueryBuilder.cs
- QueryUtil.cs
- SessionPageStatePersister.cs
- Activator.cs
- SqlUDTStorage.cs
- ArcSegment.cs
- AccessedThroughPropertyAttribute.cs
- TransformCollection.cs
- OutputCacheSection.cs
- SelectedCellsCollection.cs
- Errors.cs
- XmlChildEnumerator.cs
- CodeLinePragma.cs
- DBDataPermissionAttribute.cs
- IsolatedStoragePermission.cs
- XmlCollation.cs
- AsyncOperation.cs
- MessageBuilder.cs
- DirectionalLight.cs
- _NativeSSPI.cs
- ByteStack.cs
- TextParagraph.cs
- ApplicationProxyInternal.cs
- MultipartContentParser.cs
- _NegotiateClient.cs
- SecureEnvironment.cs
- FixedStringLookup.cs
- InkCanvasSelectionAdorner.cs
- OdbcEnvironment.cs
- XmlDataSourceView.cs
- Selection.cs
- BamlTreeMap.cs
- AutoGeneratedField.cs
- TTSVoice.cs
- ParserExtension.cs