Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / Data / Constraint.cs / 1 / 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)) ] #if WINFSInternalOnly internal #else public #endif 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. ////// #if WINFSInternalOnly #else [CLSCompliant(false)] #endif 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. // Copyright (c) Microsoft Corporation. All rights reserved.Sets the constraint's ///.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HostingEnvironmentException.cs
- PeerEndPoint.cs
- XPathNodeInfoAtom.cs
- QilName.cs
- Accessible.cs
- DynamicPropertyHolder.cs
- InputEventArgs.cs
- RuntimeDelegateArgument.cs
- HtmlControlPersistable.cs
- SpeechRecognizer.cs
- TrustManagerMoreInformation.cs
- TextEditorMouse.cs
- XmlNode.cs
- CodeTypeOfExpression.cs
- CustomErrorCollection.cs
- BinHexEncoder.cs
- StylusDevice.cs
- HtmlProps.cs
- ReadOnlyPropertyMetadata.cs
- BooleanExpr.cs
- HttpApplication.cs
- MarkupExtensionReturnTypeAttribute.cs
- XmlSchemaSubstitutionGroup.cs
- RadioButtonAutomationPeer.cs
- HMACSHA512.cs
- UriTemplateDispatchFormatter.cs
- Component.cs
- RectAnimationBase.cs
- ColorTypeConverter.cs
- XmlSchemaAttributeGroup.cs
- WeakReferenceEnumerator.cs
- DetailsViewDeleteEventArgs.cs
- WindowsFormsHelpers.cs
- StylusEditingBehavior.cs
- DataViewManager.cs
- CultureTableRecord.cs
- NodeFunctions.cs
- ReadWriteSpinLock.cs
- PictureBox.cs
- EnumerableCollectionView.cs
- TableRowGroupCollection.cs
- CompositeDataBoundControl.cs
- TreeNodeConverter.cs
- CompilationUtil.cs
- SafeNativeMemoryHandle.cs
- WindowsTooltip.cs
- FixedSOMPage.cs
- ContainerUtilities.cs
- Transform.cs
- ProtocolsConfigurationEntry.cs
- ErrorHandler.cs
- BamlRecordHelper.cs
- _ShellExpression.cs
- AsyncPostBackTrigger.cs
- UIElement3D.cs
- BooleanFacetDescriptionElement.cs
- UrlAuthFailedErrorFormatter.cs
- MultitargetingHelpers.cs
- ZipIOLocalFileDataDescriptor.cs
- WindowShowOrOpenTracker.cs
- ClientRuntimeConfig.cs
- SettingsPropertyIsReadOnlyException.cs
- RowsCopiedEventArgs.cs
- Rule.cs
- SerialPort.cs
- SearchForVirtualItemEventArgs.cs
- BitArray.cs
- PropertyOrder.cs
- PersistChildrenAttribute.cs
- XamlFigureLengthSerializer.cs
- ConfigurationSectionHelper.cs
- ValueConversionAttribute.cs
- ConvertersCollection.cs
- Int32EqualityComparer.cs
- ZoomingMessageFilter.cs
- TextDecorationCollection.cs
- StyleSelector.cs
- ValueCollectionParameterReader.cs
- TextEffect.cs
- CardSpaceSelector.cs
- ContentPlaceHolder.cs
- IteratorFilter.cs
- DecimalAnimationUsingKeyFrames.cs
- StructureChangedEventArgs.cs
- MissingMemberException.cs
- FragmentQuery.cs
- XmlSchemaIdentityConstraint.cs
- PageCache.cs
- TemplateBamlRecordReader.cs
- StaticSiteMapProvider.cs
- ToolBar.cs
- TextServicesLoader.cs
- OdbcConnectionFactory.cs
- ConfigurationSettings.cs
- xdrvalidator.cs
- NestedContainer.cs
- WebPartCatalogAddVerb.cs
- DataControlFieldCell.cs
- ScrollBarRenderer.cs
- AbstractSvcMapFileLoader.cs