Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. //------------------------------------------------------------------------------ //Sets the constraint's ///. // 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.Sets the constraint's ///.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextServicesProperty.cs
- Help.cs
- ProfileModule.cs
- KeyEvent.cs
- SafeSerializationManager.cs
- CheckoutException.cs
- SimpleApplicationHost.cs
- AssemblyBuilderData.cs
- SystemMulticastIPAddressInformation.cs
- TableRow.cs
- UDPClient.cs
- _Events.cs
- XPathSelectionIterator.cs
- NavigationProperty.cs
- OptimizerPatterns.cs
- DocumentSequenceHighlightLayer.cs
- SecurityResources.cs
- PlaceHolder.cs
- StringUtil.cs
- ConfigXmlAttribute.cs
- ContentDisposition.cs
- EditorPartChrome.cs
- CurrentChangingEventArgs.cs
- Compiler.cs
- initElementDictionary.cs
- IntSecurity.cs
- PaintEvent.cs
- BuildProviderAppliesToAttribute.cs
- SubtreeProcessor.cs
- ErrorHandlerModule.cs
- ResourceProviderFactory.cs
- UnionCodeGroup.cs
- EventListener.cs
- Stroke.cs
- Clipboard.cs
- ExtensionDataObject.cs
- Stackframe.cs
- QueryStringParameter.cs
- ApplicationFileParser.cs
- EntityDesignerDataSourceView.cs
- EntityContainerRelationshipSetEnd.cs
- MetadataArtifactLoaderCompositeFile.cs
- SymmetricKeyWrap.cs
- AmbientValueAttribute.cs
- ExtensibleClassFactory.cs
- DrawingContextWalker.cs
- DispatcherHookEventArgs.cs
- HtmlFormWrapper.cs
- KeyMatchBuilder.cs
- BoundingRectTracker.cs
- DesignerRegionCollection.cs
- WebResourceAttribute.cs
- WebPartConnectionsDisconnectVerb.cs
- ObjectListItemCollection.cs
- MemberDomainMap.cs
- CompiledQuery.cs
- BatchStream.cs
- ContextMenuStrip.cs
- CheckableControlBaseAdapter.cs
- CaseStatementProjectedSlot.cs
- AliasedExpr.cs
- QualifierSet.cs
- DecimalConstantAttribute.cs
- XmlQueryTypeFactory.cs
- CancellationHandler.cs
- EnvironmentPermission.cs
- CodeNamespaceImport.cs
- Wildcard.cs
- AnnotationObservableCollection.cs
- LinkLabelLinkClickedEvent.cs
- StreamWithDictionary.cs
- CodeTypeMember.cs
- PictureBox.cs
- XmlHierarchyData.cs
- FileController.cs
- TransactionFlowBindingElementImporter.cs
- ExecutionEngineException.cs
- AsyncResult.cs
- Win32.cs
- DataSetUtil.cs
- ToolStripContainer.cs
- OrderingInfo.cs
- Brush.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- KeyToListMap.cs
- MasterPage.cs
- UTF8Encoding.cs
- ProfileProvider.cs
- HttpListener.cs
- CodePageUtils.cs
- ScrollContentPresenter.cs
- ResourcePart.cs
- DES.cs
- MaskedTextProvider.cs
- DataSourceHelper.cs
- RequestCache.cs
- PropertyGeneratedEventArgs.cs
- WindowInteractionStateTracker.cs
- Point3DAnimationBase.cs
- DummyDataSource.cs