Beispiel #1
0
        /// <summary>
        /// Gets the expression.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="serviceInstance">The service instance.</param>
        /// <param name="parameterExpression">The parameter expression.</param>
        /// <param name="selection">The selection.</param>
        /// <returns></returns>
        public override Expression GetExpression(Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 2)
            {
                Guid tagGuid    = selectionValues[1].AsGuid();
                var  tagItemQry = new TaggedItemService((RockContext)serviceInstance.Context).Queryable()
                                  .Where(x => x.Tag.Guid == tagGuid);

                var qry = new PersonService((RockContext)serviceInstance.Context).Queryable()
                          .Where(p => tagItemQry.Any(x => x.EntityGuid == p.Guid));

                return(FilterExpressionExtractor.Extract <Rock.Model.Person>(qry, parameterExpression, "p"));
            }

            return(null);
        }