//---------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql
{
using System.Collections.Generic;
using System.Data.Common.CommandTrees;
using System.Data.Common.EntitySql;
using System.Data.Common.Utils;
using System.Data.Metadata.Edm;
using System.Diagnostics;
///
/// Entity SQL Parser result information.
///
public sealed class ParseResult
{
private readonly DbCommandTree _commandTree;
private readonly System.Collections.ObjectModel.ReadOnlyCollection _functionDefs;
internal ParseResult(DbCommandTree commandTree, List functionDefs)
{
EntityUtil.CheckArgumentNull(commandTree, "commandTree");
EntityUtil.CheckArgumentNull(functionDefs, "functionDefs");
this._commandTree = commandTree;
this._functionDefs = functionDefs.AsReadOnly();
}
///
/// A command tree produced during parsing.
///
public DbCommandTree CommandTree { get { return _commandTree; } }
///
/// List of objects describing query inline function definitions.
///
public System.Collections.ObjectModel.ReadOnlyCollection FunctionDefinitions { get { return this._functionDefs; } }
}
///
/// Entity SQL query inline function definition, returned as a part of .
///
public sealed class FunctionDefinition
{
private readonly string _name;
private readonly DbLambda _lambda;
private readonly int _startPosition;
private readonly int _endPosition;
internal FunctionDefinition(string name, DbLambda lambda, int startPosition, int endPosition)
{
Debug.Assert(name != null, "name can not be null");
Debug.Assert(lambda != null, "lambda cannot be null");
this._name = name;
this._lambda = lambda;
this._startPosition = startPosition;
this._endPosition = endPosition;
}
///
/// Function name.
///
public string Name { get { return this._name; } }
///
/// Function body and parameters.
///
public DbLambda Lambda { get { return this._lambda; } }
///
/// Start position of the function definition in the eSQL query text.
///
public int StartPosition { get { return this._startPosition; } }
///
/// End position of the function definition in the eSQL query text.
///
public int EndPosition { get { return this._endPosition; } }
}
}