Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Common / EntitySql / NamespaceExpr.cs / 3 / NamespaceExpr.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....] [....]
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql
{
using System;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
///
/// represents an ast node for namespace declaration
///
internal sealed class NamespaceExpr : Expr
{
private Identifier _namespaceAlias;
private DottedIdentifier _namespaceName;
///
/// initializes ns as single id
///
///
internal NamespaceExpr( Identifier identifier )
{
_namespaceName = new DottedIdentifier(identifier);
}
///
/// initializes ns as a dotted id
///
///
internal NamespaceExpr( DotExpr dotExpr )
{
if (!dotExpr.IsDottedIdentifier)
{
throw EntityUtil.EntitySqlError(dotExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
_namespaceName = new DottedIdentifier(dotExpr);
}
///
/// initializes aliased ns
///
///
///
///
///
internal NamespaceExpr( BuiltInExpr bltInExpr )
{
_namespaceAlias = null;
Identifier aliasId = bltInExpr.Arg1 as Identifier;
if (null == aliasId)
{
throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, System.Data.Entity.Strings.InvalidNamespaceAlias);
}
if (aliasId.IsEscaped)
{
throw EntityUtil.EntitySqlError(aliasId.ErrCtx.QueryText, System.Data.Entity.Strings.InvalidEscapedNamespaceAlias, aliasId.ErrCtx.InputPosition);
}
_namespaceAlias = aliasId;
if (bltInExpr.Arg2 is Identifier)
{
_namespaceName = new DottedIdentifier((Identifier)bltInExpr.Arg2);
}
else if (bltInExpr.Arg2 is DotExpr)
{
DotExpr dotExpr = (DotExpr)bltInExpr.Arg2;
if (!dotExpr.IsDottedIdentifier)
{
throw EntityUtil.EntitySqlError(dotExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
_namespaceName = new DottedIdentifier(dotExpr);
}
else
{
throw EntityUtil.EntitySqlError(bltInExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
}
///
/// returns ns alias id if exists
///
internal Identifier AliasIdentifier
{
get { return _namespaceAlias; }
}
///
/// returns namespace dotted id
///
internal DottedIdentifier NamespaceName
{
get { return _namespaceName; }
}
///
/// returns true if ns is aliased
///
internal bool IsAliased
{
get { return (null != _namespaceAlias); }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....] [....]
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql
{
using System;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
///
/// represents an ast node for namespace declaration
///
internal sealed class NamespaceExpr : Expr
{
private Identifier _namespaceAlias;
private DottedIdentifier _namespaceName;
///
/// initializes ns as single id
///
///
internal NamespaceExpr( Identifier identifier )
{
_namespaceName = new DottedIdentifier(identifier);
}
///
/// initializes ns as a dotted id
///
///
internal NamespaceExpr( DotExpr dotExpr )
{
if (!dotExpr.IsDottedIdentifier)
{
throw EntityUtil.EntitySqlError(dotExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
_namespaceName = new DottedIdentifier(dotExpr);
}
///
/// initializes aliased ns
///
///
///
///
///
internal NamespaceExpr( BuiltInExpr bltInExpr )
{
_namespaceAlias = null;
Identifier aliasId = bltInExpr.Arg1 as Identifier;
if (null == aliasId)
{
throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, System.Data.Entity.Strings.InvalidNamespaceAlias);
}
if (aliasId.IsEscaped)
{
throw EntityUtil.EntitySqlError(aliasId.ErrCtx.QueryText, System.Data.Entity.Strings.InvalidEscapedNamespaceAlias, aliasId.ErrCtx.InputPosition);
}
_namespaceAlias = aliasId;
if (bltInExpr.Arg2 is Identifier)
{
_namespaceName = new DottedIdentifier((Identifier)bltInExpr.Arg2);
}
else if (bltInExpr.Arg2 is DotExpr)
{
DotExpr dotExpr = (DotExpr)bltInExpr.Arg2;
if (!dotExpr.IsDottedIdentifier)
{
throw EntityUtil.EntitySqlError(dotExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
_namespaceName = new DottedIdentifier(dotExpr);
}
else
{
throw EntityUtil.EntitySqlError(bltInExpr.ErrCtx, System.Data.Entity.Strings.InvalidNamespace);
}
}
///
/// returns ns alias id if exists
///
internal Identifier AliasIdentifier
{
get { return _namespaceAlias; }
}
///
/// returns namespace dotted id
///
internal DottedIdentifier NamespaceName
{
get { return _namespaceName; }
}
///
/// returns true if ns is aliased
///
internal bool IsAliased
{
get { return (null != _namespaceAlias); }
}
}
}
// 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
- HoistedLocals.cs
- Int64Storage.cs
- ScanQueryOperator.cs
- DesignTimeParseData.cs
- CorrelationQueryBehavior.cs
- SqlBuffer.cs
- CuspData.cs
- EventHandlerList.cs
- SafeUserTokenHandle.cs
- ToolStripSplitStackLayout.cs
- OleDbRowUpdatedEvent.cs
- ExpressionConverter.cs
- DataRecordInternal.cs
- ReachBasicContext.cs
- ListViewTableRow.cs
- Style.cs
- SqlColumnizer.cs
- VerbConverter.cs
- SortAction.cs
- WebBrowserUriTypeConverter.cs
- RtfControls.cs
- CategoryNameCollection.cs
- DesignTimeHTMLTextWriter.cs
- DbgUtil.cs
- CodeGroup.cs
- TickBar.cs
- Formatter.cs
- GenericEnumConverter.cs
- SystemIPGlobalProperties.cs
- LabelLiteral.cs
- AttachedPropertyBrowsableAttribute.cs
- MetadataCollection.cs
- VersionedStream.cs
- PropertyCondition.cs
- TypeViewSchema.cs
- ExpressionBindingCollection.cs
- CompiledScopeCriteria.cs
- IIS7WorkerRequest.cs
- AutomationPropertyInfo.cs
- PreloadedPackages.cs
- ElementNotEnabledException.cs
- HttpServerVarsCollection.cs
- SignerInfo.cs
- XmlSchemaAttributeGroup.cs
- _DigestClient.cs
- TransformPattern.cs
- StrokeCollection.cs
- TrackBar.cs
- Shape.cs
- TransformBlockRequest.cs
- PenThreadPool.cs
- TextEndOfParagraph.cs
- OdbcRowUpdatingEvent.cs
- ListMarkerLine.cs
- WebPartConnectionsCancelEventArgs.cs
- HttpCapabilitiesEvaluator.cs
- HtmlTitle.cs
- DtcInterfaces.cs
- HandleCollector.cs
- Camera.cs
- SerializationStore.cs
- SingleResultAttribute.cs
- GroupDescription.cs
- TextWriterTraceListener.cs
- DesignTimeTemplateParser.cs
- EmptyControlCollection.cs
- Point.cs
- MarginsConverter.cs
- RequestCachingSection.cs
- ADConnectionHelper.cs
- PackWebRequestFactory.cs
- WindowInteropHelper.cs
- MsdtcWrapper.cs
- WorkflowOwnerAsyncResult.cs
- HttpListener.cs
- ControllableStoryboardAction.cs
- XamlSerializerUtil.cs
- ScrollItemPatternIdentifiers.cs
- SiteMapDataSource.cs
- ReadOnlyDataSource.cs
- ReadOnlyDictionary.cs
- ManagementObject.cs
- LicFileLicenseProvider.cs
- ObjectDataSourceDesigner.cs
- DoubleLink.cs
- ObjectDataSourceWizardForm.cs
- FontSizeConverter.cs
- ZipIOCentralDirectoryBlock.cs
- Geometry3D.cs
- DbParameterCollection.cs
- DoubleLinkList.cs
- DirectionalLight.cs
- EmptyArray.cs
- PixelFormatConverter.cs
- View.cs
- XsdDataContractExporter.cs
- ColorAnimationUsingKeyFrames.cs
- DataControlField.cs
- ErasingStroke.cs
- SqlNodeTypeOperators.cs