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
- CharEnumerator.cs
- RadioButtonRenderer.cs
- DecimalConstantAttribute.cs
- UIElement.cs
- HtmlElementCollection.cs
- EditorPartCollection.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- UnSafeCharBuffer.cs
- StdValidatorsAndConverters.cs
- EventlogProvider.cs
- sqlcontext.cs
- AssociationSetEnd.cs
- SimpleTypesSurrogate.cs
- ServiceModelSecurityTokenRequirement.cs
- CodeLabeledStatement.cs
- ViewStateModeByIdAttribute.cs
- FileSystemWatcher.cs
- TreeViewDataItemAutomationPeer.cs
- HtmlInputImage.cs
- StringExpressionSet.cs
- WSHttpTransportSecurityElement.cs
- GenericXmlSecurityToken.cs
- ActivityDesignerResources.cs
- MeshGeometry3D.cs
- WebBrowser.cs
- SoapServerProtocol.cs
- TraceContext.cs
- ConnectionInterfaceCollection.cs
- FrameworkContentElementAutomationPeer.cs
- LinkClickEvent.cs
- NativeObjectSecurity.cs
- FacetValueContainer.cs
- ToolStripPanelCell.cs
- OpenTypeCommon.cs
- BasicExpressionVisitor.cs
- NameSpaceEvent.cs
- SqlColumnizer.cs
- Storyboard.cs
- URLAttribute.cs
- CacheEntry.cs
- X509Utils.cs
- SplitContainer.cs
- QuaternionValueSerializer.cs
- OleDbFactory.cs
- PrefixQName.cs
- SiblingIterators.cs
- ColorConverter.cs
- HttpContext.cs
- InheritablePropertyChangeInfo.cs
- DrawingGroupDrawingContext.cs
- SqlBulkCopy.cs
- MenuEventArgs.cs
- ToolStripActionList.cs
- InfoCardTrace.cs
- DefaultShape.cs
- WebColorConverter.cs
- MultiDataTrigger.cs
- ListViewUpdateEventArgs.cs
- FixedTextBuilder.cs
- SoapSchemaImporter.cs
- TypeUtils.cs
- WebBrowserNavigatingEventHandler.cs
- TerminatorSinks.cs
- RegisteredDisposeScript.cs
- XmlReader.cs
- MasterPageBuildProvider.cs
- Int64AnimationBase.cs
- DataServiceRequestOfT.cs
- DataGridItemCollection.cs
- SiteMapDesignerDataSourceView.cs
- TextEditorMouse.cs
- WindowsFont.cs
- PrintPreviewDialog.cs
- xmlNames.cs
- MemberAccessException.cs
- SqlDelegatedTransaction.cs
- DataContractSerializerSection.cs
- XmlDataLoader.cs
- DuplicateDetector.cs
- DataGridRowAutomationPeer.cs
- TimeManager.cs
- ISAPIRuntime.cs
- Script.cs
- TimeSpanValidatorAttribute.cs
- GroupBox.cs
- Vector.cs
- GridItemPatternIdentifiers.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- DataContext.cs
- GifBitmapEncoder.cs
- DataGridAddNewRow.cs
- ButtonBaseAdapter.cs
- Annotation.cs
- VarRemapper.cs
- ObjectAssociationEndMapping.cs
- Util.cs
- SoundPlayerAction.cs
- ErrorTolerantObjectWriter.cs
- IIS7WorkerRequest.cs
- FrameworkElementFactory.cs