Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / Constraint.cs / 1305376 / Constraint.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System; using System.ComponentModel; using System.Globalization; ////// [ DefaultProperty("ConstraintName"), TypeConverter(typeof(ConstraintConverter)) ] public abstract class Constraint { internal String name = ""; private String _schemaName = ""; private bool inCollection = false; private DataSet dataSet = null; internal PropertyCollection extendedProperties = null; ///Represents a constraint that can be enforced on one or /// more ///objects. /// [ DefaultValue(""), ResDescriptionAttribute(Res.ConstraintNameDescr), ResCategoryAttribute(Res.DataCategory_Data) ] public virtual string ConstraintName { get { return name; } set { if (value == null) value = ""; if (Common.ADP.IsEmpty(value) && (Table != null) && InCollection) throw ExceptionBuilder.NoConstraintName(); CultureInfo locale = (Table != null ? Table.Locale : CultureInfo.CurrentCulture); if (String.Compare(name, value, true, locale) != 0) { if ((Table != null) && InCollection) { Table.Constraints.RegisterName(value); if (name.Length != 0) Table.Constraints.UnregisterName(name); } name = value; } else if (String.Compare(name, value, false, locale) != 0) { name = value; } } } internal String SchemaName { get { if (Common.ADP.IsEmpty(_schemaName)) return ConstraintName; else return _schemaName; } set { if (!Common.ADP.IsEmpty(value)) _schemaName = value; } } internal virtual bool InCollection { get { // ACCESSOR: virtual was missing from this get return inCollection; } set { inCollection = value; if (value) dataSet = Table.DataSet; else dataSet = null; } } ///The name of this constraint within the ////// . /// [ResDescriptionAttribute(Res.ConstraintTableDescr)] public abstract DataTable Table { get; } ///Gets the ///to which the constraint applies. /// [ ResCategoryAttribute(Res.DataCategory_Data), Browsable(false), ResDescriptionAttribute(Res.ExtendedPropertiesDescr) ] public PropertyCollection ExtendedProperties { get { if (extendedProperties == null) { extendedProperties = new PropertyCollection(); } return extendedProperties; } } internal abstract bool ContainsColumn(DataColumn column); internal abstract bool CanEnableConstraint(); internal abstract Constraint Clone(DataSet destination); internal abstract Constraint Clone(DataSet destination, bool ignoreNSforTableLookup); internal void CheckConstraint() { if (!CanEnableConstraint()) { throw ExceptionBuilder.ConstraintViolation(ConstraintName); } } internal abstract void CheckCanAddToCollection(ConstraintCollection constraint); internal abstract bool CanBeRemovedFromCollection(ConstraintCollection constraint, bool fThrowException); internal abstract void CheckConstraint(DataRow row, DataRowAction action); internal abstract void CheckState(); protected void CheckStateForProperty() { try { CheckState(); } catch (Exception e) { // if (!Common.ADP.IsCatchableExceptionType (e)) { throw; } throw ExceptionBuilder.BadObjectPropertyAccess(e.Message); } } ///Gets the collection of customized user information. ////// [CLSCompliant(false)] protected virtual DataSet _DataSet { get { return dataSet; } } ///Gets the ///to which this constraint belongs. /// protected internal void SetDataSet(DataSet dataSet) { this.dataSet = dataSet; } internal abstract bool IsConstraintViolated(); public override string ToString() { return ConstraintName; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Sets the constraint's ///.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Size3D.cs
- DataRowChangeEvent.cs
- NoClickablePointException.cs
- StorageEndPropertyMapping.cs
- PersonalizationStateQuery.cs
- NamedPermissionSet.cs
- Registry.cs
- SnapshotChangeTrackingStrategy.cs
- DataColumnChangeEvent.cs
- StackBuilderSink.cs
- CardSpaceSelector.cs
- BinHexDecoder.cs
- SetStoryboardSpeedRatio.cs
- WebPartConnectionsCancelVerb.cs
- CustomTokenProvider.cs
- RoutedUICommand.cs
- ThemeDirectoryCompiler.cs
- HtmlTitle.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ApplicationTrust.cs
- RegionData.cs
- XsdDataContractExporter.cs
- ImageClickEventArgs.cs
- _NtlmClient.cs
- SafeCryptoHandles.cs
- VectorKeyFrameCollection.cs
- TextEndOfSegment.cs
- WebPartConnectVerb.cs
- ForeignConstraint.cs
- XslAst.cs
- RawStylusInput.cs
- ByteKeyFrameCollection.cs
- XmlElement.cs
- ByteStack.cs
- DeploymentExceptionMapper.cs
- ListViewCommandEventArgs.cs
- SqlTypeSystemProvider.cs
- CategoryNameCollection.cs
- AdRotatorDesigner.cs
- WebPartUserCapability.cs
- BitmapEffectGroup.cs
- WindowsRichEdit.cs
- HttpHandlersSection.cs
- Constants.cs
- ResponseStream.cs
- ZipPackagePart.cs
- SqlWebEventProvider.cs
- ComponentRenameEvent.cs
- WebBodyFormatMessageProperty.cs
- BindableAttribute.cs
- ProtocolsSection.cs
- EncryptedPackage.cs
- TextParagraphProperties.cs
- ViewService.cs
- XmlDataProvider.cs
- MailMessageEventArgs.cs
- StringUtil.cs
- ProcessModule.cs
- PkcsMisc.cs
- SafeProcessHandle.cs
- CombinedGeometry.cs
- XmlNavigatorFilter.cs
- DefaultSerializationProviderAttribute.cs
- ReadOnlyDictionary.cs
- AuthenticationManager.cs
- LayoutTable.cs
- DirectoryGroupQuery.cs
- RevocationPoint.cs
- ClientData.cs
- BaseDataBoundControl.cs
- ZipIOCentralDirectoryBlock.cs
- WindowsSecurityTokenAuthenticator.cs
- TreeViewDataItemAutomationPeer.cs
- InstanceCreationEditor.cs
- DiscoveryEndpointValidator.cs
- AssociatedControlConverter.cs
- DataGridViewColumnCollection.cs
- HttpCacheVary.cs
- MetaData.cs
- Duration.cs
- DataGridViewTextBoxColumn.cs
- SafeMemoryMappedViewHandle.cs
- SiteMapHierarchicalDataSourceView.cs
- SafeThemeHandle.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- PeerApplication.cs
- AbstractExpressions.cs
- SerializationStore.cs
- mediaeventshelper.cs
- BrowserDefinitionCollection.cs
- _RequestLifetimeSetter.cs
- InputScopeConverter.cs
- SpellerError.cs
- RowUpdatedEventArgs.cs
- MissingMethodException.cs
- FormViewCommandEventArgs.cs
- PropertyDescriptorComparer.cs
- TargetControlTypeCache.cs
- CodeGotoStatement.cs
- IssuedSecurityTokenParameters.cs