Code:
/ 4.0 / 4.0 / 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 ///. // 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
- HtmlInputHidden.cs
- Context.cs
- figurelengthconverter.cs
- XMLDiffLoader.cs
- BasicCellRelation.cs
- MemoryFailPoint.cs
- ConstraintConverter.cs
- ISAPIRuntime.cs
- DocComment.cs
- PaintValueEventArgs.cs
- BrowserCapabilitiesFactoryBase.cs
- OSFeature.cs
- MasterPage.cs
- ServiceHandle.cs
- Block.cs
- StringArrayEditor.cs
- DataServiceExpressionVisitor.cs
- Signature.cs
- CultureTableRecord.cs
- TrackBarRenderer.cs
- ProtectedConfigurationSection.cs
- RuleRef.cs
- BitmapSizeOptions.cs
- X509SecurityTokenAuthenticator.cs
- PaintEvent.cs
- JoinElimination.cs
- TraceSection.cs
- StringComparer.cs
- EntityAdapter.cs
- SafeNativeMethods.cs
- XmlDataSourceNodeDescriptor.cs
- DataGridItemEventArgs.cs
- Int32.cs
- UIntPtr.cs
- XmlCharacterData.cs
- PropertyValidationContext.cs
- SchemaElementDecl.cs
- XmlFileEditor.cs
- HttpResponseInternalWrapper.cs
- Schema.cs
- Menu.cs
- RepeaterItemEventArgs.cs
- RawStylusInputCustomDataList.cs
- HttpPostLocalhostServerProtocol.cs
- SqlMetaData.cs
- RequestStatusBarUpdateEventArgs.cs
- _ChunkParse.cs
- AsyncStreamReader.cs
- ValidationResults.cs
- ErasingStroke.cs
- SamlAuthenticationStatement.cs
- DataRowView.cs
- ISSmlParser.cs
- XamlParser.cs
- ReadWriteSpinLock.cs
- ClientScriptManager.cs
- GlobalEventManager.cs
- EditCommandColumn.cs
- XmlCDATASection.cs
- TraceHandlerErrorFormatter.cs
- InstanceDataCollection.cs
- HtmlInputHidden.cs
- VariantWrapper.cs
- FunctionUpdateCommand.cs
- HelpKeywordAttribute.cs
- Facet.cs
- DataGridCellsPanel.cs
- DbCommandTree.cs
- WasAdminWrapper.cs
- XmlSerializerNamespaces.cs
- AssertFilter.cs
- dtdvalidator.cs
- SafeNativeMethodsOther.cs
- TextPointer.cs
- WpfGeneratedKnownTypes.cs
- ToolStripPanel.cs
- KeyEvent.cs
- TypeElement.cs
- QueryOperator.cs
- RuntimeEnvironment.cs
- BinaryReader.cs
- CharEnumerator.cs
- exports.cs
- XmlDictionaryWriter.cs
- bidPrivateBase.cs
- RadialGradientBrush.cs
- SingleStorage.cs
- SymLanguageType.cs
- XmlExtensionFunction.cs
- regiisutil.cs
- CodeAttributeArgumentCollection.cs
- CodeParameterDeclarationExpression.cs
- CacheAxisQuery.cs
- BrowserDefinition.cs
- DBConnectionString.cs
- DataSourceXmlSerializer.cs
- SqlLiftWhereClauses.cs
- QuerySelectOp.cs
- CursorConverter.cs
- RecognitionEventArgs.cs