本文整理汇总了C#中QueryExpression.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# QueryExpression.GetType方法的具体用法?C# QueryExpression.GetType怎么用?C# QueryExpression.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryExpression
的用法示例。
在下文中一共展示了QueryExpression.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSelectQueryStatement
private WSelectQueryExpression ParseSelectQueryStatement(QueryExpression queryExpr)
{
if (queryExpr == null)
{
return null;
}
switch (queryExpr.GetType().Name)
{
case "BinaryQueryExpression":
{
var bqe = queryExpr as BinaryQueryExpression;
var pQueryExpr = new WBinaryQueryExpression
{
All = bqe.All,
FirstQueryExpr = ParseSelectQueryStatement(bqe.FirstQueryExpression),
SecondQueryExpr = ParseSelectQueryStatement(bqe.SecondQueryExpression),
FirstTokenIndex = bqe.FirstTokenIndex,
LastTokenIndex = bqe.LastTokenIndex
};
//pQueryExpr.OrderByExpr = parseOrderbyExpr(bqe.OrderByClause);
return pQueryExpr;
}
case "QueryParenthesisExpression":
{
var qpe = queryExpr as QueryParenthesisExpression;
var pQueryExpr = new WQueryParenthesisExpression
{
QueryExpr = ParseSelectQueryStatement(qpe.QueryExpression),
FirstTokenIndex = qpe.FirstTokenIndex,
LastTokenIndex = qpe.LastTokenIndex
};
//pQueryExpr.OrderByExpr = parseOrderbyExpr(qpe.OrderByClause);
return pQueryExpr;
}
case "QuerySpecification":
{
var qs = queryExpr as QuerySpecification;
var pQueryExpr = new WSelectQueryBlock
{
FirstTokenIndex = qs.FirstTokenIndex,
LastTokenIndex = qs.LastTokenIndex,
SelectElements = new List<WSelectElement>(qs.SelectElements.Count),
};
//
// SELECT clause
//
foreach (var wsel in qs.SelectElements.Select(ParseSelectElement).Where(wsel => wsel != null))
{
pQueryExpr.SelectElements.Add(wsel);
}
//
// Top row filter
//
if (qs.TopRowFilter != null)
{
pQueryExpr.TopRowFilter = new WTopRowFilter
{
Percent = qs.TopRowFilter.Percent,
WithTies = qs.TopRowFilter.WithTies,
Expression = ParseScalarExpression(qs.TopRowFilter.Expression),
FirstTokenIndex = qs.TopRowFilter.FirstTokenIndex,
LastTokenIndex = qs.TopRowFilter.LastTokenIndex
};
}
pQueryExpr.UniqueRowFilter = qs.UniqueRowFilter;
//
// FROM clause
//
if (qs.FromClause != null && qs.FromClause.TableReferences != null)
{
pQueryExpr.FromClause.FirstTokenIndex = qs.FromClause.FirstTokenIndex;
pQueryExpr.FromClause.LastTokenIndex = qs.FromClause.LastTokenIndex;
pQueryExpr.FromClause.TableReferences = new List<WTableReference>(qs.FromClause.TableReferences.Count);
foreach (var pref in qs.FromClause.TableReferences.Select(ParseTableReference).Where(pref => pref != null))
{
pQueryExpr.FromClause.TableReferences.Add(pref);
}
}
//
// WHERE clause
//
if (qs.WhereClause != null && qs.WhereClause.SearchCondition != null)
{
pQueryExpr.WhereClause.FirstTokenIndex = qs.WhereClause.FirstTokenIndex;
pQueryExpr.WhereClause.LastTokenIndex = qs.WhereClause.LastTokenIndex;
pQueryExpr.WhereClause.SearchCondition = ParseBooleanExpression(qs.WhereClause.SearchCondition);
}
//.........这里部分代码省略.........