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
- EncodingNLS.cs
- BlurEffect.cs
- DataSourceConverter.cs
- LocalizableAttribute.cs
- EditingCoordinator.cs
- MsmqIntegrationReceiveParameters.cs
- LateBoundBitmapDecoder.cs
- EventLogPermissionEntry.cs
- Debug.cs
- IISMapPath.cs
- RectAnimationBase.cs
- CodePrimitiveExpression.cs
- GradientSpreadMethodValidation.cs
- ConvertEvent.cs
- cookie.cs
- SqlCommandBuilder.cs
- SqlDeflator.cs
- PermissionSet.cs
- PeerApplicationLaunchInfo.cs
- SplitterPanel.cs
- WebOperationContext.cs
- GraphicsState.cs
- SystemThemeKey.cs
- ZipQueryOperator.cs
- TextEffect.cs
- XPathNodeList.cs
- XPathNavigatorReader.cs
- AnnotationObservableCollection.cs
- TraceSection.cs
- IODescriptionAttribute.cs
- TemplateBindingExtensionConverter.cs
- RectangleF.cs
- RelationshipEndCollection.cs
- PrintController.cs
- WebBrowserPermission.cs
- InvokePatternIdentifiers.cs
- UrlMappingsSection.cs
- externdll.cs
- ThemeableAttribute.cs
- TextRangeBase.cs
- CollectionsUtil.cs
- GeometryGroup.cs
- GreenMethods.cs
- WebPartZoneBase.cs
- TypedTableBase.cs
- DesignerFrame.cs
- TargetFrameworkUtil.cs
- ParagraphResult.cs
- EnumerableCollectionView.cs
- TypeConverters.cs
- SqlCharStream.cs
- MaxValueConverter.cs
- TaskFormBase.cs
- EventsTab.cs
- ExplicitDiscriminatorMap.cs
- TraceShell.cs
- XmlSchemaSimpleType.cs
- ComponentCollection.cs
- SingleStorage.cs
- TextRangeEditLists.cs
- OdbcCommand.cs
- BridgeDataRecord.cs
- ContentFilePart.cs
- CustomCredentialPolicy.cs
- ResourceWriter.cs
- EntityDataSourceStatementEditor.cs
- ValueSerializerAttribute.cs
- DataGridViewRowHeaderCell.cs
- DBSqlParser.cs
- Timeline.cs
- SQLByteStorage.cs
- ArgumentException.cs
- basenumberconverter.cs
- ToReply.cs
- QilReplaceVisitor.cs
- PropertyToken.cs
- XmlSchemaSimpleContentRestriction.cs
- XmlNode.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SymLanguageType.cs
- UIElement.cs
- ContentPosition.cs
- WebPartRestoreVerb.cs
- ClientSideProviderDescription.cs
- DependencySource.cs
- TableItemProviderWrapper.cs
- _DomainName.cs
- Trace.cs
- ClientOptions.cs
- IxmlLineInfo.cs
- ConfigXmlReader.cs
- HtmlInputSubmit.cs
- ConfigXmlSignificantWhitespace.cs
- XmlConvert.cs
- EntityViewContainer.cs
- SelectedDatesCollection.cs
- PointCollectionConverter.cs
- BrowserCapabilitiesFactory.cs
- PointF.cs
- UnknownBitmapEncoder.cs