Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- TriggerBase.cs
- ArgIterator.cs
- Permission.cs
- SingleAnimation.cs
- ColorConverter.cs
- StylusButtonCollection.cs
- TextViewSelectionProcessor.cs
- UnsafeNativeMethods.cs
- LayoutSettings.cs
- Point.cs
- New.cs
- ApplicationActivator.cs
- XPathException.cs
- ColumnResizeAdorner.cs
- OutputWindow.cs
- Path.cs
- SoapReflectionImporter.cs
- DispatcherSynchronizationContext.cs
- XmlILStorageConverter.cs
- RotateTransform3D.cs
- CoTaskMemUnicodeSafeHandle.cs
- FixedSOMPageElement.cs
- QuaternionAnimation.cs
- Image.cs
- XsltContext.cs
- SingleTagSectionHandler.cs
- TextComposition.cs
- XmlQueryStaticData.cs
- CompilerState.cs
- HandlerBase.cs
- ListViewInsertEventArgs.cs
- PerformanceCounter.cs
- EllipseGeometry.cs
- CachingHintValidation.cs
- InitializerFacet.cs
- HierarchicalDataBoundControl.cs
- Enlistment.cs
- InstancePersistenceException.cs
- ImageButton.cs
- MDIClient.cs
- RequestCachingSection.cs
- EncryptedReference.cs
- MutexSecurity.cs
- LinqDataView.cs
- PopupRoot.cs
- PersonalizableAttribute.cs
- TextEditorCharacters.cs
- EventKeyword.cs
- ObjectDataSourceFilteringEventArgs.cs
- XmlWellformedWriterHelpers.cs
- DiagnosticTrace.cs
- OleAutBinder.cs
- HtmlObjectListAdapter.cs
- ExportOptions.cs
- BoolLiteral.cs
- TextSelectionHelper.cs
- SyncOperationState.cs
- ServiceContractViewControl.Designer.cs
- XmlSchemaAnyAttribute.cs
- CompilationUtil.cs
- FilterableAttribute.cs
- ReadContentAsBinaryHelper.cs
- DesignTimeDataBinding.cs
- TextHidden.cs
- Byte.cs
- Page.cs
- FontWeightConverter.cs
- ContextStaticAttribute.cs
- SecurityTokenAuthenticator.cs
- SoapHttpTransportImporter.cs
- QueryProcessor.cs
- LOSFormatter.cs
- TypeForwardedToAttribute.cs
- IntegerValidator.cs
- DoubleConverter.cs
- ModuleBuilderData.cs
- TextRangeProviderWrapper.cs
- OracleConnection.cs
- RegionData.cs
- ForEachAction.cs
- AppDomainAttributes.cs
- SqlLiftWhereClauses.cs
- AttachedAnnotationChangedEventArgs.cs
- AbandonedMutexException.cs
- SelectionHighlightInfo.cs
- LicenseManager.cs
- ProcessModelSection.cs
- CompositeFontParser.cs
- WindowsSolidBrush.cs
- Parameter.cs
- QilChoice.cs
- HandlerBase.cs
- FixedDocumentSequencePaginator.cs
- PrivilegeNotHeldException.cs
- ComplexType.cs
- ParameterCollection.cs
- DataServiceProcessingPipeline.cs
- DataTransferEventArgs.cs
- AutomationElement.cs
- MetadataItemSerializer.cs