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
- BaseAsyncResult.cs
- InstanceNameConverter.cs
- OperationCanceledException.cs
- WinInetCache.cs
- Privilege.cs
- CodeTypeParameterCollection.cs
- SqlDataSourceSelectingEventArgs.cs
- Matrix3DValueSerializer.cs
- CommonRemoteMemoryBlock.cs
- HelpPage.cs
- PrivateFontCollection.cs
- HtmlInputControl.cs
- BrowserCapabilitiesFactoryBase.cs
- IItemContainerGenerator.cs
- QilTargetType.cs
- ListViewItemEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- PreviousTrackingServiceAttribute.cs
- GatewayDefinition.cs
- CanonicalFontFamilyReference.cs
- OrderedEnumerableRowCollection.cs
- UserControlCodeDomTreeGenerator.cs
- InputProcessorProfiles.cs
- TokenBasedSet.cs
- StaticExtension.cs
- EncryptedData.cs
- EmptyEnumerable.cs
- CodeActivityMetadata.cs
- Random.cs
- TransformerTypeCollection.cs
- StringReader.cs
- SelectionWordBreaker.cs
- DataGridViewTopLeftHeaderCell.cs
- WebPartMenu.cs
- TransactionChannelListener.cs
- ReferencedType.cs
- StorageEntityContainerMapping.cs
- ListBase.cs
- FigureParagraph.cs
- ValueType.cs
- UIntPtr.cs
- DoubleAnimationClockResource.cs
- EventLogPermissionEntryCollection.cs
- DataControlReferenceCollection.cs
- FileLogRecordHeader.cs
- ToolStripTextBox.cs
- ToolStripPanel.cs
- AppDomainAttributes.cs
- Variable.cs
- DBParameter.cs
- namescope.cs
- TreeViewItem.cs
- StylusButtonEventArgs.cs
- ObjectCacheSettings.cs
- SafeNativeMethods.cs
- FaultContractAttribute.cs
- ResponseStream.cs
- CheckBoxField.cs
- MessageFormatterConverter.cs
- StoryFragments.cs
- CatalogPartCollection.cs
- ProjectionCamera.cs
- ExtractorMetadata.cs
- ElementsClipboardData.cs
- ProtocolsConfigurationEntry.cs
- MethodAccessException.cs
- CallbackDebugBehavior.cs
- CompositeDispatchFormatter.cs
- SingleAnimationUsingKeyFrames.cs
- InvalidWMPVersionException.cs
- TextParentUndoUnit.cs
- HashMembershipCondition.cs
- Wizard.cs
- Calendar.cs
- DataServiceRequest.cs
- MatrixAnimationUsingKeyFrames.cs
- ScriptResourceHandler.cs
- BaseCollection.cs
- Environment.cs
- UIElementIsland.cs
- AppSettingsExpressionBuilder.cs
- Compiler.cs
- ResponseStream.cs
- SiteMap.cs
- Transactions.cs
- WorkflowApplicationCompletedEventArgs.cs
- GeneralTransform3DGroup.cs
- XamlGridLengthSerializer.cs
- XmlSecureResolver.cs
- FilterableAttribute.cs
- HttpRawResponse.cs
- MetabaseReader.cs
- ImageListStreamer.cs
- DayRenderEvent.cs
- EventLogEntry.cs
- WebUtil.cs
- EventLogConfiguration.cs
- BitmapDecoder.cs
- CqlLexerHelpers.cs
- SourceSwitch.cs