本文整理汇总了C#中Tile.GetNamedQueries方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.GetNamedQueries方法的具体用法?C# Tile.GetNamedQueries怎么用?C# Tile.GetNamedQueries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.GetNamedQueries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CoverAttributes
private bool CoverAttributes(
ref Tile<FragmentQuery> rewriting,
Dictionary<MemberPath, FragmentQuery> attributeConditions)
{
// first, account for already used views
var usedViews = new HashSet<FragmentQuery>(rewriting.GetNamedQueries());
Debug.Assert(usedViews.Count > 0);
//List<FragmentQuery> usedViewsList = new List<FragmentQuery>(usedViews);
//usedViewsList.Sort(FragmentQuery.GetComparer(toFillQuery.Attributes));
foreach (var view in usedViews)
{
foreach (var projectedAttribute in NonKeys(view.Attributes))
{
CoverAttribute(projectedAttribute, view, attributeConditions);
}
if (attributeConditions.Count == 0)
{
return true; // we are done
}
}
// still need to fill some attributes
Tile<FragmentQuery> attributeTile = null;
foreach (var view in _fragmentQueries)
{
foreach (var projectedAttribute in NonKeys(view.Attributes))
{
if (CoverAttribute(projectedAttribute, view, attributeConditions))
{
attributeTile = (attributeTile == null) ? CreateTile(view) : _qp.Union(attributeTile, CreateTile(view));
}
}
if (attributeConditions.Count == 0)
{
break; // we are done!
}
}
if (attributeConditions.Count == 0)
{
// yes, we covered all attributes
Debug.Assert(attributeTile != null);
rewriting = _qp.Join(rewriting, attributeTile);
return true;
}
else
{
// create rewriting that we couldn't satisfy
return false; // couldn't cover some attribute(s)
}
}
示例2: FindRewritingAndUsedViews
// Find rewriting for query SELECT <attributes> WHERE <whereClause> FROM _extentPath
// and add view appearing in rewriting to outputUsedViews
private bool FindRewritingAndUsedViews(
IEnumerable<MemberPath> attributes, BoolExpression whereClause,
HashSet<FragmentQuery> outputUsedViews, out Tile<FragmentQuery> rewriting,
out IEnumerable<MemberPath> notCoveredAttributes)
{
if (FindRewriting(attributes, whereClause, out rewriting, out notCoveredAttributes))
{
outputUsedViews.UnionWith(rewriting.GetNamedQueries());
return true;
}
return false;
}
示例3: FindRewriting
// Find rewriting for query SELECT <attributes> WHERE <whereClause> FROM _extentPath
private bool FindRewriting(
IEnumerable<MemberPath> attributes, BoolExpression whereClause,
out Tile<FragmentQuery> rewriting, out IEnumerable<MemberPath> notCoveredAttributes)
{
Tile<FragmentQuery> toFill = CreateTile(FragmentQuery.Create(attributes, whereClause));
Debug.Assert(toFill.Query.Attributes.Count > 0, "Query has no attributes?");
Tile<FragmentQuery> toAvoid = CreateTile(FragmentQuery.Create(_keyAttributes, BoolExpression.CreateNot(whereClause)));
var isRelaxed = (_context.ViewTarget == ViewTarget.UpdateView);
var found = RewriteQuery(toFill, toAvoid, out rewriting, out notCoveredAttributes, isRelaxed);
Debug.Assert(
!found || rewriting.GetNamedQueries().All(q => q != _trueViewSurrogate.Query),
"TrueViewSurrogate should have been substituted");
return found;
}
示例4: GetUsedViewsAndRemoveTrueSurrogate
private HashSet<FragmentQuery> GetUsedViewsAndRemoveTrueSurrogate(ref Tile<FragmentQuery> rewriting)
{
var usedViews = new HashSet<FragmentQuery>(rewriting.GetNamedQueries());
if (!usedViews.Contains(_trueViewSurrogate.Query))
{
return usedViews; // no surrogate
}
// remove the surrogate
usedViews.Remove(_trueViewSurrogate.Query);
// first, try to union usedViews to see whether we can get True
Tile<FragmentQuery> unionTile = null;
var usedFollowedByUnusedViews = usedViews.Concat(_fragmentQueries);
foreach (var view in usedFollowedByUnusedViews)
{
unionTile = (unionTile == null) ? CreateTile(view) : _qp.Union(unionTile, CreateTile(view));
usedViews.Add(view);
if (IsTrue(unionTile.Query))
{
// we found a true rewriting
rewriting = rewriting.Replace(_trueViewSurrogate, unionTile);
return usedViews;
}
}
// now we either found the rewriting or we can just take all views because we are in relaxed mode for update views
Debug.Fail("Shouldn't happen");
return usedViews;
}