private static int GetQueryVersion(IEnumerable <string> propertyNames) { int result = TableVersion.Get(typeof(T)); QueryInfo queryInfo = GetQueryInfo(propertyNames); foreach (Type t in queryInfo.ReferencedDataTypes) { result += TableVersion.Get(t); } return(result); }
public override object Execute(ParameterList parameters, FunctionContextContainer context) { SitemapScope SitemapScope; Expression filter; if (parameters.TryGetParameter <SitemapScope>("SitemapScope", out SitemapScope) == false) { SitemapScope = SitemapScope.Current; } switch (SitemapScope) { case SitemapScope.Current: Guid currentPageId = PageRenderer.CurrentPageId; filter = Expression.Equal(_foreignKeyPropertyExpression, Expression.Constant(currentPageId)); break; case SitemapScope.All: filter = Expression.Constant(true); break; default: Guid pageId = PageRenderer.CurrentPageId; IEnumerable <Guid> pageIds = new FilterWrapper( pageId, SitemapScope, TableVersion.Get(typeof(IPageStructure)), PageStructureInfo.GetAssociatedPageIds(pageId, SitemapScope)); Expression <Func <Guid, bool> > containsExpression = f => pageIds.Contains(f); filter = Expression.Invoke(containsExpression, _foreignKeyPropertyExpression); break; } return(Expression.Lambda <Func <T, bool> >(filter, new ParameterExpression[] { _parameterExpression })); }