Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ProcessHost.cs
- TrackingAnnotationCollection.cs
- SystemDiagnosticsSection.cs
- ScriptResourceHandler.cs
- SubstitutionList.cs
- SystemIPInterfaceStatistics.cs
- MethodToken.cs
- XmlSchemaCollection.cs
- ScriptBehaviorDescriptor.cs
- __Filters.cs
- ComponentChangingEvent.cs
- categoryentry.cs
- ResolveResponseInfo.cs
- XPathAxisIterator.cs
- BufferModeSettings.cs
- HostUtils.cs
- FixUp.cs
- BindingMemberInfo.cs
- PolyQuadraticBezierSegment.cs
- SafeFileMapViewHandle.cs
- SqlDataSourceCache.cs
- HttpModulesSection.cs
- MsmqAppDomainProtocolHandler.cs
- ClassValidator.cs
- TextLine.cs
- VisemeEventArgs.cs
- ClassGenerator.cs
- DateTimeConstantAttribute.cs
- MsmqIntegrationMessagePool.cs
- UIElementParagraph.cs
- StyleXamlParser.cs
- SendActivityEventArgs.cs
- uribuilder.cs
- SystemUnicastIPAddressInformation.cs
- ObjectContext.cs
- TransactionFlowElement.cs
- LinqDataSource.cs
- AttributeSetAction.cs
- Formatter.cs
- SoapHeader.cs
- ExtenderProviderService.cs
- QueueAccessMode.cs
- Polyline.cs
- SqlSelectClauseBuilder.cs
- OperationResponse.cs
- control.ime.cs
- WorkflowInstanceTerminatedRecord.cs
- JsonEncodingStreamWrapper.cs
- BaseResourcesBuildProvider.cs
- ValidatorCollection.cs
- SimpleTypeResolver.cs
- RC2CryptoServiceProvider.cs
- ValidationSummary.cs
- HttpResponseInternalBase.cs
- StorageEntityContainerMapping.cs
- BorderGapMaskConverter.cs
- DataGridBoundColumn.cs
- XamlNamespaceHelper.cs
- COM2ComponentEditor.cs
- WmlCalendarAdapter.cs
- ExtensionSimplifierMarkupObject.cs
- UnionCqlBlock.cs
- ConfigurationProperty.cs
- WinFormsUtils.cs
- StreamInfo.cs
- Calendar.cs
- ComEventsSink.cs
- ToolStripProgressBar.cs
- XMLSyntaxException.cs
- HtmlWindow.cs
- Geometry3D.cs
- SystemNetworkInterface.cs
- CacheEntry.cs
- ArgIterator.cs
- CompareValidator.cs
- XmlSchemaInclude.cs
- SmiEventSink_Default.cs
- CodeParameterDeclarationExpressionCollection.cs
- ArraySortHelper.cs
- AddInPipelineAttributes.cs
- HttpListenerTimeoutManager.cs
- ErrorTolerantObjectWriter.cs
- KnownIds.cs
- CurrencyWrapper.cs
- Image.cs
- xsdvalidator.cs
- SQLDecimalStorage.cs
- Point3DKeyFrameCollection.cs
- PropertyMappingExceptionEventArgs.cs
- SHA256Managed.cs
- RolePrincipal.cs
- CompModSwitches.cs
- InputLanguageCollection.cs
- WindowsComboBox.cs
- ListControl.cs
- HwndSource.cs
- RegexRunnerFactory.cs
- FactoryId.cs
- MetadataReference.cs
- DesignerObject.cs