本文整理汇总了C#中QueryModel.GetNewName方法的典型用法代码示例。如果您正苦于以下问题:C# QueryModel.GetNewName方法的具体用法?C# QueryModel.GetNewName怎么用?C# QueryModel.GetNewName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryModel
的用法示例。
在下文中一共展示了QueryModel.GetNewName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModifyFetchQueryModel
/// <summary>
/// Modifies the given query model for fetching, adding an <see cref="AdditionalFromClause"/> and changing the <see cref="SelectClause.Selector"/> to
/// retrieve the result of the <see cref="AdditionalFromClause"/>.
/// For example, a fetch request such as <c>FetchMany (x => x.Orders)</c> will be transformed into a <see cref="AdditionalFromClause"/> selecting
/// <c>y.Orders</c> (where <c>y</c> is what the query model originally selected) and a <see cref="SelectClause"/> selecting the result of the
/// <see cref="AdditionalFromClause"/>.
/// This method is called by <see cref="FetchRequestBase.CreateFetchQueryModel"/> in the process of creating the new fetch query model.
/// </summary>
protected override void ModifyFetchQueryModel (QueryModel fetchQueryModel)
{
ArgumentUtility.CheckNotNull ("fetchQueryModel", fetchQueryModel);
var fromExpression = Expression.MakeMemberAccess (new QuerySourceReferenceExpression (fetchQueryModel.MainFromClause), RelationMember);
var memberFromClause = new AdditionalFromClause (fetchQueryModel.GetNewName ("#fetch"), _relatedObjectType, fromExpression);
fetchQueryModel.BodyClauses.Add (memberFromClause);
var newSelector = new QuerySourceReferenceExpression (memberFromClause);
var newSelectClause = new SelectClause (newSelector);
fetchQueryModel.SelectClause = newSelectClause;
}