Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / DbFunctionCommandTree.cs / 1305376 / DbFunctionCommandTree.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
using System.Linq;
namespace System.Data.Common.CommandTrees
{
///
/// Represents a function invocation expressed as a canonical command tree
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbFunctionCommandTree : DbCommandTree
{
private readonly EdmFunction _edmFunction;
private readonly TypeUsage _resultType;
private readonly System.Collections.ObjectModel.ReadOnlyCollection _parameterNames;
private readonly System.Collections.ObjectModel.ReadOnlyCollection _parameterTypes;
///
/// Constructs a new DbFunctionCommandTree that uses the specified metadata workspace, data space and function metadata
///
/// The metadata workspace that the command tree should use.
/// The logical 'space' that metadata in the expressions used in this command tree must belong to.
///
///
///
/// , or is null
/// does not represent a valid data space or
/// is a composable function
/*CQT_PUBLIC_API(*/internal/*)*/ DbFunctionCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, EdmFunction edmFunction, TypeUsage resultType, IEnumerable> parameters)
: base(metadata, dataSpace)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
EntityUtil.CheckArgumentNull(edmFunction, "edmFunction");
_edmFunction = edmFunction;
_resultType = resultType;
List paramNames = new List();
List paramTypes = new List();
if (parameters != null)
{
foreach (KeyValuePair paramInfo in parameters)
{
paramNames.Add(paramInfo.Key);
paramTypes.Add(paramInfo.Value);
}
}
_parameterNames = paramNames.AsReadOnly();
_parameterTypes = paramTypes.AsReadOnly();
}
}
///
/// Gets the that represents the function to invoke
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Edm")]
public EdmFunction EdmFunction
{
get
{
return _edmFunction;
}
}
///
/// Gets the result type of the function; currently constrained to be a Collection of
/// RowTypes. Unlike typical RowType instance, merely indicates name/type not parameter
/// order.
///
public TypeUsage ResultType
{
get
{
return _resultType;
}
}
internal override DbCommandTreeKind CommandTreeKind
{
get { return DbCommandTreeKind.Function; }
}
internal override IEnumerable> GetParameters()
{
for (int idx = 0; idx < this._parameterNames.Count; idx++)
{
yield return new KeyValuePair(this._parameterNames[idx], this._parameterTypes[idx]);
}
}
internal override void DumpStructure(ExpressionDumper dumper)
{
if (this.EdmFunction != null)
{
dumper.Dump(this.EdmFunction);
}
}
internal override string PrintTree(ExpressionPrinter printer)
{
return printer.Print(this);
}
}
}
// 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.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
using System.Linq;
namespace System.Data.Common.CommandTrees
{
///
/// Represents a function invocation expressed as a canonical command tree
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbFunctionCommandTree : DbCommandTree
{
private readonly EdmFunction _edmFunction;
private readonly TypeUsage _resultType;
private readonly System.Collections.ObjectModel.ReadOnlyCollection _parameterNames;
private readonly System.Collections.ObjectModel.ReadOnlyCollection _parameterTypes;
///
/// Constructs a new DbFunctionCommandTree that uses the specified metadata workspace, data space and function metadata
///
/// The metadata workspace that the command tree should use.
/// The logical 'space' that metadata in the expressions used in this command tree must belong to.
///
///
///
/// , or is null
/// does not represent a valid data space or
/// is a composable function
/*CQT_PUBLIC_API(*/internal/*)*/ DbFunctionCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, EdmFunction edmFunction, TypeUsage resultType, IEnumerable> parameters)
: base(metadata, dataSpace)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
EntityUtil.CheckArgumentNull(edmFunction, "edmFunction");
_edmFunction = edmFunction;
_resultType = resultType;
List paramNames = new List();
List paramTypes = new List();
if (parameters != null)
{
foreach (KeyValuePair paramInfo in parameters)
{
paramNames.Add(paramInfo.Key);
paramTypes.Add(paramInfo.Value);
}
}
_parameterNames = paramNames.AsReadOnly();
_parameterTypes = paramTypes.AsReadOnly();
}
}
///
/// Gets the that represents the function to invoke
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Edm")]
public EdmFunction EdmFunction
{
get
{
return _edmFunction;
}
}
///
/// Gets the result type of the function; currently constrained to be a Collection of
/// RowTypes. Unlike typical RowType instance, merely indicates name/type not parameter
/// order.
///
public TypeUsage ResultType
{
get
{
return _resultType;
}
}
internal override DbCommandTreeKind CommandTreeKind
{
get { return DbCommandTreeKind.Function; }
}
internal override IEnumerable> GetParameters()
{
for (int idx = 0; idx < this._parameterNames.Count; idx++)
{
yield return new KeyValuePair(this._parameterNames[idx], this._parameterTypes[idx]);
}
}
internal override void DumpStructure(ExpressionDumper dumper)
{
if (this.EdmFunction != null)
{
dumper.Dump(this.EdmFunction);
}
}
internal override string PrintTree(ExpressionPrinter printer)
{
return printer.Print(this);
}
}
}
// 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
- Point.cs
- NTAccount.cs
- MouseActionConverter.cs
- WebConfigurationManager.cs
- Light.cs
- SecurityDescriptor.cs
- DWriteFactory.cs
- ObfuscationAttribute.cs
- EditorPart.cs
- MenuItemStyleCollection.cs
- HtmlDocument.cs
- DataBinder.cs
- Listen.cs
- ChannelToken.cs
- FormViewRow.cs
- ResourceDescriptionAttribute.cs
- EntityContainer.cs
- SafeLibraryHandle.cs
- GraphicsState.cs
- NavigatingCancelEventArgs.cs
- XmlSerializationReader.cs
- InternalConfigEventArgs.cs
- BookmarkEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- QilName.cs
- AnnotationAuthorChangedEventArgs.cs
- _NegotiateClient.cs
- ClientConfigurationHost.cs
- XPathException.cs
- FtpCachePolicyElement.cs
- Domain.cs
- SecurityPermission.cs
- PropertyGridDesigner.cs
- HtmlElementEventArgs.cs
- ColorConvertedBitmap.cs
- WindowsListViewItemStartMenu.cs
- PeerInvitationResponse.cs
- ContentPlaceHolder.cs
- ClientScriptManagerWrapper.cs
- MultiSelectRootGridEntry.cs
- MultilineStringConverter.cs
- MultiTouchSystemGestureLogic.cs
- FacetChecker.cs
- DocumentAutomationPeer.cs
- DataTableClearEvent.cs
- SimpleHandlerFactory.cs
- SoapSchemaMember.cs
- GridViewItemAutomationPeer.cs
- SqlDependencyUtils.cs
- MeasurementDCInfo.cs
- HttpResponseHeader.cs
- ElementAction.cs
- ImageFormatConverter.cs
- DetailsViewDesigner.cs
- COMException.cs
- processwaithandle.cs
- ObjectParameter.cs
- IndexOutOfRangeException.cs
- RichTextBox.cs
- WorkflowQueueInfo.cs
- ComboBoxRenderer.cs
- coordinatorfactory.cs
- ResourceReferenceKeyNotFoundException.cs
- ClientSideProviderDescription.cs
- BaseCAMarshaler.cs
- WorkflowViewManager.cs
- XmlConverter.cs
- HttpCookieCollection.cs
- TrustManagerPromptUI.cs
- ProvidePropertyAttribute.cs
- SqlBuffer.cs
- relpropertyhelper.cs
- XmlSchemaAnnotated.cs
- WebExceptionStatus.cs
- XmlCharCheckingWriter.cs
- ValueQuery.cs
- FontStyles.cs
- PublisherIdentityPermission.cs
- ListenerChannelContext.cs
- HotCommands.cs
- TextRangeEditTables.cs
- EventDriven.cs
- ProtocolElement.cs
- BypassElement.cs
- OfTypeExpression.cs
- Style.cs
- CapabilitiesState.cs
- ThrowOnMultipleAssignment.cs
- HierarchicalDataBoundControlAdapter.cs
- TextTrailingWordEllipsis.cs
- SqlMethodTransformer.cs
- ComplexLine.cs
- OleDbRowUpdatingEvent.cs
- XMLDiffLoader.cs
- RenderData.cs
- COAUTHIDENTITY.cs
- RequestQueue.cs
- AuthenticationConfig.cs
- GridProviderWrapper.cs
- TextElementAutomationPeer.cs