当前位置: 首页>>代码示例>>C#>>正文


C# Tile.GetNamedQueries方法代码示例

本文整理汇总了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)
     }
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:49,代码来源:QueryRewriter.cs

示例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;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:14,代码来源:QueryRewriter.cs

示例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;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:16,代码来源:QueryRewriter.cs

示例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;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:28,代码来源:QueryRewriter.cs


注:本文中的Tile.GetNamedQueries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。