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
- GregorianCalendarHelper.cs
- ReadOnlyDataSource.cs
- ExclusiveTcpTransportManager.cs
- LoginView.cs
- MasterPageParser.cs
- PackageController.cs
- TypeDelegator.cs
- Dictionary.cs
- PasswordRecoveryDesigner.cs
- EventDescriptor.cs
- Animatable.cs
- ApplicationSecurityInfo.cs
- MimePart.cs
- InertiaTranslationBehavior.cs
- TextPointerBase.cs
- SecurityElement.cs
- HttpApplicationFactory.cs
- AutoGeneratedFieldProperties.cs
- DataGridAddNewRow.cs
- PageContent.cs
- LoginUtil.cs
- WindowsToolbarAsMenu.cs
- connectionpool.cs
- MenuItemStyleCollection.cs
- ObjectStateEntryDbDataRecord.cs
- Icon.cs
- ImageFormatConverter.cs
- ResourceDescriptionAttribute.cs
- MarkupCompiler.cs
- PageHandlerFactory.cs
- FormView.cs
- QueuePathEditor.cs
- ObjectDesignerDataSourceView.cs
- AutoCompleteStringCollection.cs
- FilterableAttribute.cs
- Buffer.cs
- ExpressionList.cs
- CryptoProvider.cs
- LabelDesigner.cs
- EdmProviderManifest.cs
- RewritingPass.cs
- ByteStreamGeometryContext.cs
- NumericUpDownAccelerationCollection.cs
- TextEffectCollection.cs
- RequestStatusBarUpdateEventArgs.cs
- ModelItemKeyValuePair.cs
- ValidationService.cs
- AttributeProviderAttribute.cs
- XmlEntityReference.cs
- SafeFreeMibTable.cs
- CleanUpVirtualizedItemEventArgs.cs
- RectIndependentAnimationStorage.cs
- MappingMetadataHelper.cs
- DocumentApplication.cs
- ContainerControlDesigner.cs
- HtmlUtf8RawTextWriter.cs
- MediaEntryAttribute.cs
- ServiceInfo.cs
- UnsafeNativeMethods.cs
- DataGridViewComboBoxColumnDesigner.cs
- CodeParameterDeclarationExpression.cs
- dbdatarecord.cs
- SafeNativeMethods.cs
- ListManagerBindingsCollection.cs
- IUnknownConstantAttribute.cs
- WebSysDisplayNameAttribute.cs
- ClientRuntimeConfig.cs
- XmlSerializationReader.cs
- PointHitTestParameters.cs
- TemplateControl.cs
- GlobalAllocSafeHandle.cs
- Inflater.cs
- ContextMenuService.cs
- ReadWriteObjectLock.cs
- AVElementHelper.cs
- Geometry3D.cs
- StreamInfo.cs
- GradientSpreadMethodValidation.cs
- OpCellTreeNode.cs
- MethodBuilderInstantiation.cs
- AttachedAnnotation.cs
- SessionParameter.cs
- SuppressMergeCheckAttribute.cs
- DataSourceIDConverter.cs
- FunctionCommandText.cs
- _LocalDataStore.cs
- NonClientArea.cs
- XmlExpressionDumper.cs
- AuthenticatingEventArgs.cs
- XsltQilFactory.cs
- Queue.cs
- CapabilitiesUse.cs
- Soap.cs
- PenCursorManager.cs
- EqualityComparer.cs
- NamespaceDecl.cs
- CookieParameter.cs
- OdbcParameter.cs
- SqlGatherProducedAliases.cs
- ToolBar.cs