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
- ProtectedConfigurationProviderCollection.cs
- ExpressionBuilderContext.cs
- FrameworkTextComposition.cs
- Int32EqualityComparer.cs
- validation.cs
- FormViewUpdatedEventArgs.cs
- StrokeRenderer.cs
- DoneReceivingAsyncResult.cs
- ExternalCalls.cs
- NavigationWindowAutomationPeer.cs
- WebContext.cs
- EntityDataSourceQueryBuilder.cs
- DelegateSerializationHolder.cs
- SqlClientPermission.cs
- MarkupExtensionSerializer.cs
- InvalidDataContractException.cs
- PhysicalAddress.cs
- Label.cs
- TextBoxBaseDesigner.cs
- BuildResult.cs
- ToolStripArrowRenderEventArgs.cs
- ApplicationInterop.cs
- EventBuilder.cs
- LogReservationCollection.cs
- SoapProtocolImporter.cs
- SmtpAuthenticationManager.cs
- SmtpSection.cs
- AccessKeyManager.cs
- MappingException.cs
- GridSplitter.cs
- ExpressionConverter.cs
- Part.cs
- DBCommandBuilder.cs
- GetRecipientRequest.cs
- CmsInterop.cs
- TouchesOverProperty.cs
- ComboBoxItem.cs
- MeasureItemEvent.cs
- ScaleTransform.cs
- ContentValidator.cs
- ParallelTimeline.cs
- QueuePathEditor.cs
- DrawToolTipEventArgs.cs
- FormViewDeletedEventArgs.cs
- ACE.cs
- ActivationServices.cs
- TextDecorationUnitValidation.cs
- ResourceReferenceExpression.cs
- XamlPathDataSerializer.cs
- AsyncOperation.cs
- MultipleViewProviderWrapper.cs
- PersonalizationStateInfo.cs
- MatrixIndependentAnimationStorage.cs
- DataControlCommands.cs
- SkewTransform.cs
- Attributes.cs
- Style.cs
- MetadataArtifactLoaderComposite.cs
- BaseTemplateBuildProvider.cs
- FormsAuthenticationEventArgs.cs
- WorkflowMarkupElementEventArgs.cs
- TypeElementCollection.cs
- BaseTemplateBuildProvider.cs
- XmlBinaryReader.cs
- FileDialog_Vista.cs
- XmlDataProvider.cs
- HttpDebugHandler.cs
- MenuItemStyleCollection.cs
- PropertyPath.cs
- EdmError.cs
- OrderByBuilder.cs
- SqlDataSourceStatusEventArgs.cs
- GridViewUpdateEventArgs.cs
- AnonymousIdentificationSection.cs
- TypedElement.cs
- ProjectedSlot.cs
- DelimitedListTraceListener.cs
- HtmlTernaryTree.cs
- RenderDataDrawingContext.cs
- HierarchicalDataTemplate.cs
- BitmapMetadataBlob.cs
- CroppedBitmap.cs
- ButtonAutomationPeer.cs
- CodeExpressionCollection.cs
- EventListener.cs
- FontFaceLayoutInfo.cs
- RepeatButtonAutomationPeer.cs
- XmlEncoding.cs
- EntityObject.cs
- DelegatingConfigHost.cs
- RandomNumberGenerator.cs
- ToolBarPanel.cs
- CssTextWriter.cs
- IncomingWebResponseContext.cs
- TemplateControlParser.cs
- BufferedStream.cs
- AppDomainManager.cs
- GridViewSortEventArgs.cs
- FamilyCollection.cs
- StringAttributeCollection.cs