本文整理汇总了C#中Remotion.Linq.Clauses.MainFromClause类的典型用法代码示例。如果您正苦于以下问题:C# MainFromClause类的具体用法?C# MainFromClause怎么用?C# MainFromClause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainFromClause类属于Remotion.Linq.Clauses命名空间,在下文中一共展示了MainFromClause类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMainFromClause
public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel)
{
Log.Trace(m => m("Original QueryModel: {0}", queryModel));
new AggressiveSubQueryFromClauseFlattener().VisitMainFromClause(fromClause, queryModel);
Log.Trace(m => m("Transformed QueryModel after AggressiveSubQueryFromClauseFlattener: {0}", queryModel));
base.VisitMainFromClause(fromClause, queryModel);
}
示例2: VisitMainFromClause
public virtual void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel)
{
ArgumentUtility.CheckNotNull ("fromClause", fromClause);
ArgumentUtility.CheckNotNull ("queryModel", queryModel);
// nothing to do here
}
示例3: VisitMainFromClause
public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel)
{
var subQueryExpression = fromClause.FromExpression as SubQueryExpression;
if (subQueryExpression != null)
FlattenSubQuery(subQueryExpression, fromClause, queryModel, 0);
base.VisitMainFromClause(fromClause, queryModel);
}
示例4: NamedEntity
public void NamedEntity ()
{
// from c in Cooks select c [with name = "inner"]
var subMainFromClause = new MainFromClause ("c", typeof(Cook), Expression.Constant (Cooks));
var subSelectClause = new SelectClause (new NamedExpression ("inner", new QuerySourceReferenceExpression (subMainFromClause)));
var subQuery = new QueryModel (subMainFromClause, subSelectClause);
// from x in (subQuery) where x.ID == null select x
var outerMainFromClause = new MainFromClause ("x", typeof(Cook), new SubQueryExpression (subQuery));
var outerWhereClause = new WhereClause(Expression.Equal(Expression.MakeMemberAccess (new QuerySourceReferenceExpression (outerMainFromClause), typeof (Cook).GetProperty ("ID")), Expression.Constant (1)));
var outerSelectClause = new SelectClause (new QuerySourceReferenceExpression (outerMainFromClause));
var outerQuery = new QueryModel (outerMainFromClause, outerSelectClause);
outerQuery.BodyClauses.Add (outerWhereClause);
CheckQuery (
outerQuery,
"SELECT [q0].[inner_ID] AS [ID],[q0].[inner_FirstName] AS [FirstName],[q0].[inner_Name] AS [Name],"
+ "[q0].[inner_IsStarredCook] AS [IsStarredCook],[q0].[inner_IsFullTimeCook] AS [IsFullTimeCook],"
+ "[q0].[inner_SubstitutedID] AS [SubstitutedID],[q0].[inner_KitchenID] AS [KitchenID],"
+ "[q0].[inner_KnifeID] AS [KnifeID],[q0].[inner_KnifeClassID] AS [KnifeClassID] "
+ "FROM (SELECT [t1].[ID] AS [inner_ID],"
+ "[t1].[FirstName] AS [inner_FirstName],[t1].[Name] AS [inner_Name],[t1].[IsStarredCook] AS [inner_IsStarredCook],"
+ "[t1].[IsFullTimeCook] AS [inner_IsFullTimeCook],[t1].[SubstitutedID] AS [inner_SubstitutedID],"
+ "[t1].[KitchenID] AS [inner_KitchenID],[t1].[KnifeID] AS [inner_KnifeID],[t1].[KnifeClassID] AS [inner_KnifeClassID] "
+ "FROM [CookTable] AS [t1]) AS [q0] WHERE ([q0].[inner_ID] = @1)",
new CommandParameter("@1", 1));
}
示例5: SetUp
public void SetUp ()
{
_mainFromClause = ExpressionHelper.CreateMainFromClause_Int();
_selectClause = ExpressionHelper.CreateSelectClause();
_queryModel = new QueryModel (_mainFromClause, _selectClause);
_querySourceMapping = new QuerySourceMapping();
}
示例6: SetUp
public void SetUp ()
{
_detailSource = ExpressionHelper.CreateQueryable<Kitchen>();
_sectorSource = ExpressionHelper.CreateQueryable<Restaurant>();
var query = from s1 in ExpressionHelper.CreateQueryable<Cook>()
from sd in
(from sector in _sectorSource
where sector.ID > 10
select sector.SubKitchen)
from s2 in s1.Assistants
where sd.Name == "Maths"
select new NonTransformedTuple<Cook, Kitchen> (s1, sd);
_queryModel = ExpressionHelper.ParseQuery (query);
_mainFromClause = _queryModel.MainFromClause;
_additionalFromClause1 = (AdditionalFromClause) _queryModel.BodyClauses[0];
_additionalFromClause2 = (AdditionalFromClause) _queryModel.BodyClauses[1];
_whereClause = (WhereClause) _queryModel.BodyClauses[2];
_selectClause = _queryModel.SelectClause;
var subQueryExpressionA = (SubQueryExpression) _additionalFromClause1.FromExpression;
_innerMainFromClauseA = subQueryExpressionA.QueryModel.MainFromClause;
_innerWhereClauseA = (WhereClause) subQueryExpressionA.QueryModel.BodyClauses[0];
_visitor = new SubQueryFromClauseFlattener();
}
示例7: FlattenSubQuery
private void FlattenSubQuery(SubQueryExpression subQueryExpression, MainFromClause fromClause,
QueryModel queryModel)
{
// Create a new client-side select for the outer
// TODO - don't like calling GetGenericArguments here...
var clientSideSelect = new ClientSideSelect(new NonAggregatingGroupBySelectRewriter().Visit(queryModel.SelectClause.Selector, subQueryExpression.Type.GetGenericArguments()[0], queryModel.MainFromClause));
// Replace the outer select clause...
queryModel.SelectClause = subQueryExpression.QueryModel.SelectClause;
MainFromClause innerMainFromClause = subQueryExpression.QueryModel.MainFromClause;
CopyFromClauseData(innerMainFromClause, fromClause);
foreach (var bodyClause in subQueryExpression.QueryModel.BodyClauses)
{
queryModel.BodyClauses.Add(bodyClause);
}
// Move the result operator up
if (queryModel.ResultOperators.Count != 0)
{
throw new NotImplementedException();
}
queryModel.ResultOperators.Add(new NonAggregatingGroupBy((GroupResultOperator) subQueryExpression.QueryModel.ResultOperators[0]));
queryModel.ResultOperators.Add(clientSideSelect);
}
示例8: Clone
/// <summary>
/// Clones this clause, registering its clone with the <paramref name="cloneContext"/>.
/// </summary>
/// <param name="cloneContext">The clones of all query source clauses are registered with this <see cref="CloneContext"/>.</param>
/// <returns>A clone of this clause.</returns>
public MainFromClause Clone (CloneContext cloneContext)
{
ArgumentUtility.CheckNotNull ("cloneContext", cloneContext);
var clone = new MainFromClause (ItemName, ItemType, FromExpression);
cloneContext.QuerySourceMapping.AddMapping (this, new QuerySourceReferenceExpression (clone));
return clone;
}
示例9: VisitMainFromClause
/// <summary>
/// 解析 from 语句
/// </summary>
/// <param name="fromClause"></param>
/// <param name="queryModel"></param>
public override void VisitMainFromClause( MainFromClause fromClause, QueryModel queryModel )
{
string itemName = fromClause.ItemName.Contains( "<generated>" ) ? "t" : fromClause.ItemName.ToLower();
this.commandBuilder.FromParts.Add( string.Format( "{0}{1}{2} {3}", Constants.LeftQuote, fromClause.ItemType.Name, Constants.RightQuote, itemName ) );
base.VisitMainFromClause( fromClause, queryModel );
}
示例10: SetUp
public void SetUp ()
{
_oldFromClause = ExpressionHelper.CreateMainFromClause_Int ();
_newFromClause = ExpressionHelper.CreateMainFromClause_Int ();
_querySourceMapping = new QuerySourceMapping ();
_querySourceMapping.AddMapping (_oldFromClause, new QuerySourceReferenceExpression (_newFromClause));
}
示例11: VisitMainFromClause
/// <summary>
/// 解析 from 语句
/// </summary>
/// <param name="fromClause"></param>
/// <param name="queryModel"></param>
public override void VisitMainFromClause( MainFromClause fromClause, QueryModel queryModel )
{
string itemName = fromClause.ItemName == "<generated>_0" ? "T" : fromClause.ItemName.ToUpper();
this.queryPartsAggregator.FromParts.Add( string.Format( "{0}{1}{0} {2}", Constants.Quote, fromClause.ItemType.Name, itemName ) );
base.VisitMainFromClause( fromClause, queryModel );
}
示例12: Initialize_WithNonConstantExpression
public void Initialize_WithNonConstantExpression ()
{
IQueryable querySource = ExpressionHelper.CreateQueryable<Cook> ();
var anonymous = new {source = querySource};
MemberExpression sourceExpression = Expression.MakeMemberAccess (Expression.Constant (anonymous), anonymous.GetType().GetProperty ("source"));
var fromClause = new MainFromClause ("s", typeof (Cook), sourceExpression);
Assert.That (fromClause.FromExpression, Is.SameAs (sourceExpression));
}
示例13: SetUp
public void SetUp ()
{
_builder = new QueryModelBuilder();
_mainFromClause = ExpressionHelper.CreateMainFromClause_Int ();
_whereClause1 = ExpressionHelper.CreateWhereClause ();
_whereClause2 = ExpressionHelper.CreateWhereClause ();
_selectClause = ExpressionHelper.CreateSelectClause ();
_resultOperator1 = ExpressionHelper.CreateResultOperator ();
_resultOperator2 = ExpressionHelper.CreateResultOperator ();
}
示例14: CreateMainFromClause
private MainFromClause CreateMainFromClause (ClauseGenerationContext clauseGenerationContext)
{
var fromClause = new MainFromClause (
AssociatedIdentifier,
QuerySourceElementType,
ParsedExpression);
clauseGenerationContext.AddContextInfo (this, fromClause);
return fromClause;
}
示例15: VisitMainFromClause
public override void VisitMainFromClause(MainFromClause fromClause, QueryModel queryModel)
{
var luceneExpression = new LuceneIndexExpression();
luceneExpression.AttachIndex(fromClause.ItemType.GetContractId());
luceneExpression.Append(fromClause.ItemType.GetContractId());
_queryParts.AddFromPart(luceneExpression);
fromClause.ItemName = "EventInternal";
base.VisitMainFromClause(fromClause, queryModel);
}