Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / FacetDescriptionElement.cs / 1 / 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
- AnnotationStore.cs
- IisTraceWebEventProvider.cs
- ISAPIRuntime.cs
- Literal.cs
- FontSourceCollection.cs
- TablePattern.cs
- EntityWithKeyStrategy.cs
- _RequestLifetimeSetter.cs
- TransactionsSectionGroup.cs
- ImageListUtils.cs
- XmlSchemaComplexContentExtension.cs
- TextUtf8RawTextWriter.cs
- DesignerForm.cs
- InvalidCastException.cs
- AddInEnvironment.cs
- DesignSurfaceManager.cs
- Events.cs
- ByteStack.cs
- UIntPtr.cs
- DataComponentGenerator.cs
- ListSourceHelper.cs
- CssClassPropertyAttribute.cs
- XmlSchemaComplexContent.cs
- XslException.cs
- CultureTableRecord.cs
- PathSegmentCollection.cs
- WindowsImpersonationContext.cs
- StatusBarPanel.cs
- PeerCollaboration.cs
- RangeValidator.cs
- XmlElementAttributes.cs
- GridViewUpdatedEventArgs.cs
- CounterCreationData.cs
- TypeUtils.cs
- sqlcontext.cs
- TextBox.cs
- ValidationHelpers.cs
- DesignerToolboxInfo.cs
- ListViewCancelEventArgs.cs
- SqlCrossApplyToCrossJoin.cs
- UnitySerializationHolder.cs
- DbParameterHelper.cs
- COM2PropertyPageUITypeConverter.cs
- invalidudtexception.cs
- AttributeCallbackBuilder.cs
- ColumnPropertiesGroup.cs
- StoreItemCollection.Loader.cs
- DefaultMergeHelper.cs
- SurrogateSelector.cs
- BrushMappingModeValidation.cs
- CodeParameterDeclarationExpressionCollection.cs
- SelectionProviderWrapper.cs
- TimeSpanSecondsConverter.cs
- DownloadProgressEventArgs.cs
- Inline.cs
- DetailsViewRow.cs
- Deserializer.cs
- TcpHostedTransportConfiguration.cs
- ImplicitInputBrush.cs
- WindowsListBox.cs
- Quad.cs
- XPSSignatureDefinition.cs
- CookieParameter.cs
- _ContextAwareResult.cs
- XmlILAnnotation.cs
- TableRowCollection.cs
- MultipleViewProviderWrapper.cs
- CornerRadius.cs
- ProfessionalColors.cs
- CellIdBoolean.cs
- GeneralTransform3DGroup.cs
- ScopelessEnumAttribute.cs
- CompositeActivityMarkupSerializer.cs
- PrimitiveXmlSerializers.cs
- SQLBinaryStorage.cs
- MatrixAnimationUsingKeyFrames.cs
- ExpandCollapseProviderWrapper.cs
- DbCommandDefinition.cs
- SyndicationSerializer.cs
- KeySpline.cs
- SerializationInfo.cs
- PresentationUIStyleResources.cs
- ModelVisual3D.cs
- FixedSOMElement.cs
- DbDataRecord.cs
- FtpRequestCacheValidator.cs
- ListInitExpression.cs
- DataChangedEventManager.cs
- LinearGradientBrush.cs
- ResourceCategoryAttribute.cs
- SQLInt32.cs
- SecurityTokenValidationException.cs
- RuleRefElement.cs
- BackgroundWorker.cs
- StrokeCollection2.cs
- KnownTypeHelper.cs
- Constant.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- IxmlLineInfo.cs
- SendMessageChannelCache.cs