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 / Documentation.cs / 2 / 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
- DataSourceCacheDurationConverter.cs
- TextHintingModeValidation.cs
- HtmlHistory.cs
- TypeValidationEventArgs.cs
- ArraySubsetEnumerator.cs
- HtmlTableRowCollection.cs
- IgnoreSectionHandler.cs
- TextFormatterImp.cs
- ComboBoxAutomationPeer.cs
- TextTreeUndo.cs
- Viewport3DVisual.cs
- ExceptionAggregator.cs
- BaseDataList.cs
- StringUtil.cs
- JsonGlobals.cs
- ToolStripSeparatorRenderEventArgs.cs
- ActivityCodeDomReferenceService.cs
- ParallelDesigner.cs
- InvalidWMPVersionException.cs
- DataMisalignedException.cs
- CurrentTimeZone.cs
- NamedPipeConnectionPoolSettings.cs
- DocumentPaginator.cs
- SequenceFullException.cs
- recordstate.cs
- ScalarType.cs
- VerificationException.cs
- ComponentResourceKeyConverter.cs
- Calendar.cs
- SubclassTypeValidator.cs
- HttpConfigurationContext.cs
- SqlTrackingWorkflowInstance.cs
- MemberMaps.cs
- Animatable.cs
- ProfileParameter.cs
- ProcessHostFactoryHelper.cs
- DataFieldCollectionEditor.cs
- TogglePattern.cs
- CreateWorkflowOwnerCommand.cs
- DesignTimeHTMLTextWriter.cs
- LineVisual.cs
- ExtendedPropertyCollection.cs
- WebPartTracker.cs
- ConditionalWeakTable.cs
- _HelperAsyncResults.cs
- SystemTcpStatistics.cs
- NegatedCellConstant.cs
- DragDeltaEventArgs.cs
- SingleObjectCollection.cs
- ConfigUtil.cs
- ScriptControlManager.cs
- EmptyEnumerable.cs
- FixedDocumentPaginator.cs
- CompositeKey.cs
- ReadOnlyAttribute.cs
- XmlLoader.cs
- ListenerSessionConnection.cs
- securitycriticaldataformultiplegetandset.cs
- SqlVersion.cs
- FilterUserControlBase.cs
- TdsParserSessionPool.cs
- CompModHelpers.cs
- GeometryDrawing.cs
- shaper.cs
- QuotedPrintableStream.cs
- ThreadExceptionDialog.cs
- DivideByZeroException.cs
- IndexedEnumerable.cs
- BitmapEffectDrawing.cs
- ChannelAcceptor.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- SmiEventSink.cs
- ServiceDescription.cs
- StorageEntityContainerMapping.cs
- mediaeventargs.cs
- SessionSwitchEventArgs.cs
- ProgressBar.cs
- TreeChangeInfo.cs
- MasterPageCodeDomTreeGenerator.cs
- DataKeyCollection.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- Brush.cs
- NamespaceInfo.cs
- DateTimeConstantAttribute.cs
- ConnectionStringSettingsCollection.cs
- FunctionCommandText.cs
- ChooseAction.cs
- TemplateModeChangedEventArgs.cs
- StorageBasedPackageProperties.cs
- CounterCreationDataConverter.cs
- OleDbStruct.cs
- XmlILModule.cs
- Rect3DValueSerializer.cs
- CipherData.cs
- IApplicationTrustManager.cs
- XsdDuration.cs
- UnaryOperationBinder.cs
- ToolboxItem.cs
- ToolStripArrowRenderEventArgs.cs
- ConfigurationStrings.cs