Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / Documentation.cs / 3 / Documentation.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Xml; using System.Data; using System.Data.Common.Utils; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.SchemaObjectModel { ////// Summary description for Documentation. /// internal sealed class DocumentationElement: SchemaElement { #region Instance Fields Documentation _metdataDocumentation = new Documentation(); #endregion #region Public Methods ////// /// /// public DocumentationElement(SchemaElement parentElement) : base(parentElement) { } ////// replace troublesome xml characters with equivalent entities /// /// text that make have characters troublesome in xml ///text with troublesome characters replaced with equivalent entities [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // referenced by System.Data.Entity.Design.dll public static string Entityize(string text) { if ( string.IsNullOrEmpty(text) ) return ""; text = text.Replace("&","&"); text = text.Replace("<","<").Replace(">",">"); return text.Replace("\'","'").Replace("\"","""); } #endregion #region Public Properties ////// Returns the wrapped metaDocumentation instance /// public Documentation MetadataDocumentation { get { _metdataDocumentation.SetReadOnly(); return _metdataDocumentation; } } #endregion #region Protected Properties protected override bool HandleElement(XmlReader reader) { if (base.HandleElement(reader)) { return true; } else if (CanHandleElement(reader, XmlConstants.Summary)) { HandleSummaryElement(reader); return true; } else if (CanHandleElement(reader, XmlConstants.LongDescription)) { HandleLongDescriptionElement(reader); return true; } return false; } #endregion #region Private Methods protected override bool HandleText(XmlReader reader) { string text = reader.Value; if (!StringUtil.IsNullOrEmptyOrWhiteSpace(text)) { AddError(ErrorCode.UnexpectedXmlElement, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.InvalidDocumentationBothTextAndStructure); } return true; } ////// /// /// private void HandleSummaryElement(XmlReader reader) { TextElement text = new TextElement(this); text.Parse(reader); _metdataDocumentation.Summary = text.Value; } ////// /// /// private void HandleLongDescriptionElement(XmlReader reader) { TextElement text = new TextElement(this); text.Parse(reader); _metdataDocumentation.LongDescription = text.Value; } #endregion } } // 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; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Xml; using System.Data; using System.Data.Common.Utils; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.SchemaObjectModel { ////// Summary description for Documentation. /// internal sealed class DocumentationElement: SchemaElement { #region Instance Fields Documentation _metdataDocumentation = new Documentation(); #endregion #region Public Methods ////// /// /// public DocumentationElement(SchemaElement parentElement) : base(parentElement) { } ////// replace troublesome xml characters with equivalent entities /// /// text that make have characters troublesome in xml ///text with troublesome characters replaced with equivalent entities [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // referenced by System.Data.Entity.Design.dll public static string Entityize(string text) { if ( string.IsNullOrEmpty(text) ) return ""; text = text.Replace("&","&"); text = text.Replace("<","<").Replace(">",">"); return text.Replace("\'","'").Replace("\"","""); } #endregion #region Public Properties ////// Returns the wrapped metaDocumentation instance /// public Documentation MetadataDocumentation { get { _metdataDocumentation.SetReadOnly(); return _metdataDocumentation; } } #endregion #region Protected Properties protected override bool HandleElement(XmlReader reader) { if (base.HandleElement(reader)) { return true; } else if (CanHandleElement(reader, XmlConstants.Summary)) { HandleSummaryElement(reader); return true; } else if (CanHandleElement(reader, XmlConstants.LongDescription)) { HandleLongDescriptionElement(reader); return true; } return false; } #endregion #region Private Methods protected override bool HandleText(XmlReader reader) { string text = reader.Value; if (!StringUtil.IsNullOrEmptyOrWhiteSpace(text)) { AddError(ErrorCode.UnexpectedXmlElement, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.InvalidDocumentationBothTextAndStructure); } return true; } ////// /// /// private void HandleSummaryElement(XmlReader reader) { TextElement text = new TextElement(this); text.Parse(reader); _metdataDocumentation.Summary = text.Value; } ////// /// /// private void HandleLongDescriptionElement(XmlReader reader) { TextElement text = new TextElement(this); text.Parse(reader); _metdataDocumentation.LongDescription = text.Value; } #endregion } } // 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
- CanExecuteRoutedEventArgs.cs
- RequestCachePolicy.cs
- DrawingState.cs
- SystemKeyConverter.cs
- NotifyInputEventArgs.cs
- MetadataArtifactLoaderComposite.cs
- SelectorItemAutomationPeer.cs
- FontFamilyConverter.cs
- MultipartIdentifier.cs
- SqlParameter.cs
- ColorContext.cs
- SoapDocumentMethodAttribute.cs
- QilTargetType.cs
- PartialTrustVisibleAssemblyCollection.cs
- EditorPartCollection.cs
- ControlType.cs
- BitmapInitialize.cs
- NumberSubstitution.cs
- TypeDescriptionProvider.cs
- webproxy.cs
- BaseDataList.cs
- ProcessHostFactoryHelper.cs
- WindowsGraphics2.cs
- EventTrigger.cs
- AsyncSerializedWorker.cs
- EventProviderClassic.cs
- DataTablePropertyDescriptor.cs
- OdbcDataAdapter.cs
- MarkupCompilePass1.cs
- EventSourceCreationData.cs
- shaper.cs
- MatchAllMessageFilter.cs
- BitVec.cs
- Vector3D.cs
- DPTypeDescriptorContext.cs
- TextSelectionHighlightLayer.cs
- EdmValidator.cs
- WindowsFormsSynchronizationContext.cs
- IsolatedStorageFile.cs
- VisualTreeUtils.cs
- SessionStateModule.cs
- XmlILCommand.cs
- XPathAncestorQuery.cs
- XmlSchemaImporter.cs
- OperationCanceledException.cs
- XmlDomTextWriter.cs
- TargetControlTypeCache.cs
- PackWebRequestFactory.cs
- SqlColumnizer.cs
- _AuthenticationState.cs
- ListViewDeletedEventArgs.cs
- ObjectStateFormatter.cs
- ExpressionBuilder.cs
- RemotingConfigParser.cs
- NavigationProperty.cs
- InvokeCompletedEventArgs.cs
- ByteRangeDownloader.cs
- GorillaCodec.cs
- CategoryGridEntry.cs
- TypeDelegator.cs
- FileDialog.cs
- PerfCounterSection.cs
- ExtendedPropertyCollection.cs
- BodyGlyph.cs
- ByteStreamMessageUtility.cs
- Roles.cs
- TextRunTypographyProperties.cs
- ThicknessAnimationBase.cs
- RectangleHotSpot.cs
- TdsParserSessionPool.cs
- UriWriter.cs
- WindowsFormsHostPropertyMap.cs
- LinqMaximalSubtreeNominator.cs
- HttpListenerException.cs
- ConvertEvent.cs
- ImageCodecInfoPrivate.cs
- EditorZone.cs
- HtmlValidationSummaryAdapter.cs
- ProcessHost.cs
- ToolboxBitmapAttribute.cs
- SoapAttributes.cs
- NgenServicingAttributes.cs
- WebPartUserCapability.cs
- SchemaImporterExtensionElementCollection.cs
- SqlNotificationEventArgs.cs
- DelegatingConfigHost.cs
- Resources.Designer.cs
- FieldMetadata.cs
- OdbcParameter.cs
- MetadataCache.cs
- TypeInfo.cs
- AutomationAttributeInfo.cs
- CompositionTarget.cs
- XamlFilter.cs
- WindowsImpersonationContext.cs
- WindowsTreeView.cs
- DelayedRegex.cs
- DetailsViewInsertEventArgs.cs
- SemanticBasicElement.cs
- QuaternionConverter.cs