Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / FacetDescriptionElement.cs / 2 / FacetDescriptionElement.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Data.Metadata.Edm; using System.Xml; using System.Diagnostics; namespace System.Data.EntityModel.SchemaObjectModel { internal abstract class FacetDescriptionElement : SchemaElement { int? _minValue; int? _maxValue; object _defaultValue; bool _isConstant; // won't be populated till you call CreateAndValidate FacetDescription _facetDescription; public FacetDescriptionElement(TypeElement type, string name) : base(type, name) { } protected override bool ProhibitAttribute(string namespaceUri, string localName) { if (base.ProhibitAttribute(namespaceUri, localName)) { return true; } if (namespaceUri == null && localName == XmlConstants.Name) { return false; } return false; } protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.MinimumAttribute)) { HandleMinimumAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.MaximumAttribute)) { HandleMaximumAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.DefaultValueAttribute)) { HandleDefaultAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.ConstantAttribute)) { HandleConstantAttribute(reader); return true; } return false; } ///////////////////////////////////////////////////////////////////// // Attribute Handlers ////// Handler for the Minimum attribute /// /// xml reader currently positioned at Minimum attribute protected void HandleMinimumAttribute(XmlReader reader) { int value = -1; if (HandleIntAttribute(reader, ref value)) { _minValue = value; } } ////// Handler for the Maximum attribute /// /// xml reader currently positioned at Maximum attribute protected void HandleMaximumAttribute(XmlReader reader) { int value = -1; if (HandleIntAttribute(reader, ref value)) { _maxValue = value; } } ////// Handler for the Default attribute /// /// xml reader currently positioned at Default attribute protected abstract void HandleDefaultAttribute(XmlReader reader); ////// Handler for the Constant attribute /// /// xml reader currently positioned at Constant attribute protected void HandleConstantAttribute(XmlReader reader) { bool value = false; if (HandleBoolAttribute(reader, ref value)) { _isConstant = value; } } public abstract EdmType FacetType{ get; } public int? MinValue { get { return _minValue; } } public int? MaxValue { get { return _maxValue; } } public object DefaultValue { get { return _defaultValue; } set { _defaultValue = value; } } public FacetDescription FacetDescription { get { Debug.Assert(_facetDescription != null, "Did you forget to call CreateAndValidate first?"); return _facetDescription; } } internal void CreateAndValidateFacetDescription(string declaringTypeName) { _facetDescription = new FacetDescription(Name, FacetType, MinValue, MaxValue, DefaultValue, _isConstant, declaringTypeName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Data.Metadata.Edm; using System.Xml; using System.Diagnostics; namespace System.Data.EntityModel.SchemaObjectModel { internal abstract class FacetDescriptionElement : SchemaElement { int? _minValue; int? _maxValue; object _defaultValue; bool _isConstant; // won't be populated till you call CreateAndValidate FacetDescription _facetDescription; public FacetDescriptionElement(TypeElement type, string name) : base(type, name) { } protected override bool ProhibitAttribute(string namespaceUri, string localName) { if (base.ProhibitAttribute(namespaceUri, localName)) { return true; } if (namespaceUri == null && localName == XmlConstants.Name) { return false; } return false; } protected override bool HandleAttribute(XmlReader reader) { if (base.HandleAttribute(reader)) { return true; } else if (CanHandleAttribute(reader, XmlConstants.MinimumAttribute)) { HandleMinimumAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.MaximumAttribute)) { HandleMaximumAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.DefaultValueAttribute)) { HandleDefaultAttribute(reader); return true; } else if (CanHandleAttribute(reader, XmlConstants.ConstantAttribute)) { HandleConstantAttribute(reader); return true; } return false; } ///////////////////////////////////////////////////////////////////// // Attribute Handlers ////// Handler for the Minimum attribute /// /// xml reader currently positioned at Minimum attribute protected void HandleMinimumAttribute(XmlReader reader) { int value = -1; if (HandleIntAttribute(reader, ref value)) { _minValue = value; } } ////// Handler for the Maximum attribute /// /// xml reader currently positioned at Maximum attribute protected void HandleMaximumAttribute(XmlReader reader) { int value = -1; if (HandleIntAttribute(reader, ref value)) { _maxValue = value; } } ////// Handler for the Default attribute /// /// xml reader currently positioned at Default attribute protected abstract void HandleDefaultAttribute(XmlReader reader); ////// Handler for the Constant attribute /// /// xml reader currently positioned at Constant attribute protected void HandleConstantAttribute(XmlReader reader) { bool value = false; if (HandleBoolAttribute(reader, ref value)) { _isConstant = value; } } public abstract EdmType FacetType{ get; } public int? MinValue { get { return _minValue; } } public int? MaxValue { get { return _maxValue; } } public object DefaultValue { get { return _defaultValue; } set { _defaultValue = value; } } public FacetDescription FacetDescription { get { Debug.Assert(_facetDescription != null, "Did you forget to call CreateAndValidate first?"); return _facetDescription; } } internal void CreateAndValidateFacetDescription(string declaringTypeName) { _facetDescription = new FacetDescription(Name, FacetType, MinValue, MaxValue, DefaultValue, _isConstant, declaringTypeName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DropShadowBitmapEffect.cs
- DiffuseMaterial.cs
- _NestedMultipleAsyncResult.cs
- TraceContext.cs
- CodeSubDirectory.cs
- FrameworkElementAutomationPeer.cs
- HighlightComponent.cs
- FixedPage.cs
- PrtCap_Public.cs
- UseAttributeSetsAction.cs
- RegisterInfo.cs
- ExpressionBuilder.cs
- DataSourceCache.cs
- BinaryObjectWriter.cs
- SamlAuthenticationClaimResource.cs
- DragDrop.cs
- TextDecorationLocationValidation.cs
- HtmlEncodedRawTextWriter.cs
- Guid.cs
- WebConfigurationHost.cs
- CommonDialog.cs
- XmlSerializerSection.cs
- AvtEvent.cs
- OpenFileDialog.cs
- Int32KeyFrameCollection.cs
- OdbcCommandBuilder.cs
- SHA512Managed.cs
- HMACSHA1.cs
- Membership.cs
- URLMembershipCondition.cs
- Slider.cs
- XmlSerializableServices.cs
- ProcessDesigner.cs
- SelectionEditor.cs
- SqlDeflator.cs
- StandardCommands.cs
- XsltCompileContext.cs
- DebugTraceHelper.cs
- HtmlInputCheckBox.cs
- WebBrowserContainer.cs
- StreamGeometry.cs
- XmlSchemaImport.cs
- PowerModeChangedEventArgs.cs
- PageRanges.cs
- KerberosSecurityTokenProvider.cs
- UiaCoreProviderApi.cs
- PrivilegedConfigurationManager.cs
- Typography.cs
- OracleInternalConnection.cs
- OrderedHashRepartitionStream.cs
- FormsAuthenticationEventArgs.cs
- BitmapEffectInput.cs
- Point3DValueSerializer.cs
- EdmTypeAttribute.cs
- Utils.cs
- KnownBoxes.cs
- SystemParameters.cs
- OpenTypeMethods.cs
- Marshal.cs
- WorkflowPersistenceService.cs
- ContentHostHelper.cs
- RequestResizeEvent.cs
- WebHeaderCollection.cs
- GradientSpreadMethodValidation.cs
- UpDownEvent.cs
- ItemCheckedEvent.cs
- XmlSerializationWriter.cs
- StorageComplexPropertyMapping.cs
- DataMemberListEditor.cs
- SqlParameterCollection.cs
- UserInitiatedNavigationPermission.cs
- RectValueSerializer.cs
- StateItem.cs
- SiteMapDataSource.cs
- MultipartIdentifier.cs
- Rectangle.cs
- BinaryKeyIdentifierClause.cs
- SystemFonts.cs
- DataGridViewHeaderCell.cs
- UriSection.cs
- tooltip.cs
- CommandField.cs
- Int64KeyFrameCollection.cs
- SolidBrush.cs
- ConfigurationValues.cs
- ItemList.cs
- GC.cs
- SqlUserDefinedAggregateAttribute.cs
- Transform3D.cs
- DocComment.cs
- CalendarTable.cs
- CompilerErrorCollection.cs
- SqlBinder.cs
- Thread.cs
- ConfigXmlAttribute.cs
- SelectionProcessor.cs
- MsmqInputMessagePool.cs
- DoubleIndependentAnimationStorage.cs
- WmpBitmapEncoder.cs
- WindowsSysHeader.cs