Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / FacetDescriptionElement.cs / 1305376 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PermissionAttributes.cs
- CornerRadiusConverter.cs
- PersianCalendar.cs
- GridViewCancelEditEventArgs.cs
- Border.cs
- OleStrCAMarshaler.cs
- CodeSnippetStatement.cs
- DataViewSetting.cs
- ExcludeFromCodeCoverageAttribute.cs
- QilGenerator.cs
- Byte.cs
- ActiveXHost.cs
- ObjectItemAttributeAssemblyLoader.cs
- SystemBrushes.cs
- AnnotationHighlightLayer.cs
- DesignerActionHeaderItem.cs
- DataGridViewToolTip.cs
- ComponentSerializationService.cs
- DescendantOverDescendantQuery.cs
- DeferredElementTreeState.cs
- FormsAuthenticationTicket.cs
- NamedPipeActivation.cs
- ServiceElement.cs
- OperationResponse.cs
- InstanceContextMode.cs
- CheckableControlBaseAdapter.cs
- _AutoWebProxyScriptEngine.cs
- QueryPageSettingsEventArgs.cs
- ReturnValue.cs
- TraceSection.cs
- PaperSize.cs
- DataGridHeaderBorder.cs
- FormatVersion.cs
- ExceptionUtility.cs
- IProvider.cs
- ColorContextHelper.cs
- BufferBuilder.cs
- PropertyMetadata.cs
- DetailsViewRowCollection.cs
- selecteditemcollection.cs
- EntityDataSource.cs
- ToolStripScrollButton.cs
- Transform3D.cs
- ChannelSinkStacks.cs
- ListItemDetailViewAttribute.cs
- XPathArrayIterator.cs
- WebHttpBindingElement.cs
- UserControl.cs
- Mapping.cs
- KoreanLunisolarCalendar.cs
- StickyNoteContentControl.cs
- SymbolPair.cs
- BaseCollection.cs
- CodeAttributeDeclarationCollection.cs
- StructuredTypeInfo.cs
- ScaleTransform.cs
- DecimalKeyFrameCollection.cs
- QilStrConcat.cs
- SettingsContext.cs
- AssemblyBuilder.cs
- WrapPanel.cs
- RelatedImageListAttribute.cs
- OleDbConnectionFactory.cs
- ComboBoxItem.cs
- SwitchDesigner.xaml.cs
- XmlEventCache.cs
- WeakRefEnumerator.cs
- WorkflowMarkupSerializer.cs
- AppDomainUnloadedException.cs
- Message.cs
- TableLayoutSettingsTypeConverter.cs
- ReadWriteObjectLock.cs
- SQLInt16.cs
- XmlILModule.cs
- LineVisual.cs
- Native.cs
- TextEditorThreadLocalStore.cs
- PassportAuthentication.cs
- GetWinFXPath.cs
- HttpListenerElement.cs
- RadioButtonFlatAdapter.cs
- ProcessThread.cs
- __Filters.cs
- ObjectIDGenerator.cs
- SessionStateItemCollection.cs
- SecureStringHasher.cs
- UnaryExpression.cs
- InitializationEventAttribute.cs
- CSharpCodeProvider.cs
- HMACSHA1.cs
- UriTemplateLiteralQueryValue.cs
- PersonalizationDictionary.cs
- ActivityTypeResolver.xaml.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- HashCodeCombiner.cs
- SubMenuStyle.cs
- Drawing.cs
- BulletedListEventArgs.cs
- GlyphRun.cs
- ManipulationLogic.cs