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 / Documentation.cs / 1 / 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
- SqlProviderServices.cs
- PipelineModuleStepContainer.cs
- GridViewAutoFormat.cs
- ProxyDataContractResolver.cs
- QueuePathEditor.cs
- ListViewSortEventArgs.cs
- LicFileLicenseProvider.cs
- DictionarySectionHandler.cs
- CollectionChangeEventArgs.cs
- TextParagraphProperties.cs
- ListViewPagedDataSource.cs
- CookieParameter.cs
- SoapParser.cs
- HyperlinkAutomationPeer.cs
- CqlBlock.cs
- TypeAccessException.cs
- AutoGeneratedFieldProperties.cs
- ContactManager.cs
- InertiaTranslationBehavior.cs
- CompiledRegexRunnerFactory.cs
- FilteredXmlReader.cs
- BCryptHashAlgorithm.cs
- dataprotectionpermission.cs
- ValueTable.cs
- ServiceOperationDetailViewControl.cs
- ToolStripItemEventArgs.cs
- DesignerAttribute.cs
- Baml2006KnownTypes.cs
- ContentElementAutomationPeer.cs
- LessThan.cs
- HtmlGenericControl.cs
- CommandTreeTypeHelper.cs
- WindowsSecurityToken.cs
- SqlServer2KCompatibilityCheck.cs
- HtmlControl.cs
- SqlVisitor.cs
- TextBoxDesigner.cs
- SqlDataSourceFilteringEventArgs.cs
- TraceContextRecord.cs
- XamlTypeMapper.cs
- NullableDecimalSumAggregationOperator.cs
- SafeNativeMethods.cs
- DateTimeSerializationSection.cs
- TypedRowHandler.cs
- SymbolResolver.cs
- PrintingPermission.cs
- shaperfactory.cs
- XmlParserContext.cs
- JavaScriptString.cs
- SlotInfo.cs
- DataServiceClientException.cs
- CreateUserWizard.cs
- MarkupWriter.cs
- AppDomainFactory.cs
- Image.cs
- JumpPath.cs
- BamlWriter.cs
- ProgramNode.cs
- MarshalByValueComponent.cs
- FrameworkElementFactory.cs
- HttpWriter.cs
- ArgumentNullException.cs
- MouseActionConverter.cs
- NavigationEventArgs.cs
- SettingsPropertyIsReadOnlyException.cs
- AddressHeaderCollectionElement.cs
- StrongNameUtility.cs
- IsolatedStorage.cs
- TableProvider.cs
- DataControlCommands.cs
- OdbcError.cs
- MULTI_QI.cs
- FastEncoderWindow.cs
- CircleHotSpot.cs
- VarInfo.cs
- _UriSyntax.cs
- CaseStatement.cs
- AutoGeneratedFieldProperties.cs
- UserControl.cs
- HtmlUtf8RawTextWriter.cs
- Color.cs
- EntityDesignerDataSourceView.cs
- TextTreeUndo.cs
- Profiler.cs
- WmlSelectionListAdapter.cs
- PersonalizationAdministration.cs
- StyleBamlRecordReader.cs
- QilTypeChecker.cs
- TimeSpanOrInfiniteConverter.cs
- EraserBehavior.cs
- VersionConverter.cs
- Path.cs
- SecurityManager.cs
- PolyQuadraticBezierSegment.cs
- DbException.cs
- IImplicitResourceProvider.cs
- Help.cs
- LineInfo.cs
- SHA384Managed.cs
- PrintDialogException.cs