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
- TagNameToTypeMapper.cs
- NamespaceQuery.cs
- AssemblyNameProxy.cs
- TabPage.cs
- TimeoutValidationAttribute.cs
- HttpWebResponse.cs
- SecurityChannelFactory.cs
- XLinq.cs
- ConnectionManagementElementCollection.cs
- Filter.cs
- StandardToolWindows.cs
- AttributeAction.cs
- DataKeyArray.cs
- StylusTip.cs
- SmiContext.cs
- Scheduler.cs
- TabletDevice.cs
- ExternalCalls.cs
- ISAPIRuntime.cs
- MsmqChannelFactory.cs
- BlurBitmapEffect.cs
- PingReply.cs
- DataGridViewComboBoxCell.cs
- PropertyToken.cs
- XMLUtil.cs
- OleStrCAMarshaler.cs
- XPathAncestorIterator.cs
- ConcurrentBag.cs
- UTF7Encoding.cs
- CodeCatchClause.cs
- X509Certificate2Collection.cs
- Matrix3DConverter.cs
- ToolStripItemImageRenderEventArgs.cs
- ColorAnimationBase.cs
- _TransmitFileOverlappedAsyncResult.cs
- InputMethodStateTypeInfo.cs
- SearchForVirtualItemEventArgs.cs
- Stack.cs
- DesignTimeVisibleAttribute.cs
- EditableTreeList.cs
- ConnectionManagementSection.cs
- SqlDataSourceCommandParser.cs
- SqlRetyper.cs
- WebScriptMetadataMessageEncoderFactory.cs
- EnumMember.cs
- RuntimeConfigLKG.cs
- SqlDelegatedTransaction.cs
- FontFaceLayoutInfo.cs
- SiteMapDataSourceView.cs
- XPathDocumentBuilder.cs
- ToolStripDropDownClosedEventArgs.cs
- CustomAssemblyResolver.cs
- FixedPageStructure.cs
- BitmapCodecInfo.cs
- XmlNamespaceMappingCollection.cs
- Table.cs
- TitleStyle.cs
- BufferedGraphicsContext.cs
- DocumentAutomationPeer.cs
- Subtree.cs
- ScopelessEnumAttribute.cs
- DnsPermission.cs
- Viewport3DAutomationPeer.cs
- SqlComparer.cs
- GroupBoxRenderer.cs
- BooleanConverter.cs
- CustomError.cs
- DisableDpiAwarenessAttribute.cs
- RewritingSimplifier.cs
- ExpressionTable.cs
- ExitEventArgs.cs
- PersonalizationEntry.cs
- ApplicationInterop.cs
- WindowsSecurityTokenAuthenticator.cs
- DataGridViewButtonCell.cs
- ProcessManager.cs
- DataGridViewImageColumn.cs
- DataGridView.cs
- AnnotationAdorner.cs
- FileStream.cs
- UnrecognizedPolicyAssertionElement.cs
- CryptoConfig.cs
- ControlEvent.cs
- FunctionMappingTranslator.cs
- Fx.cs
- ListView.cs
- XmlDomTextWriter.cs
- IndentedWriter.cs
- XmlExtensionFunction.cs
- CodeStatement.cs
- DataConnectionHelper.cs
- InternalsVisibleToAttribute.cs
- DPCustomTypeDescriptor.cs
- BindingWorker.cs
- PtsContext.cs
- DoubleConverter.cs
- StateValidator.cs
- ExpressionList.cs
- PermissionSetEnumerator.cs
- AuthorizationSection.cs