/// <summary>
        /// Creates the query.
        /// </summary>
        /// <typeparam name="TDocument">The type of the document.</typeparam>
        /// <param name="expression">The expression.</param>
        /// <returns></returns>
        public override IQueryable <TDocument> CreateQuery <TDocument>(Expression expression)
        {
            GenericQueryable <TDocument, TQuery> queryable = new ExtendedGenericQueryable <TDocument, TQuery>(this.Index, this.QueryMapper, this.QueryOptimizer, expression, this.ItemType, this.FieldNameTranslator);

            ((IHasTraceWriter)queryable).TraceWriter = ((IHasTraceWriter)this).TraceWriter;
            return(queryable);
        }
Exemple #2
0
        /// <summary>
        /// Gets the queryable.
        /// </summary>
        /// <returns></returns>
        public override IQueryable <TItem> GetQueryable()
        {
            IQueryable <TItem> queryable = new ExtendedGenericQueryable <TItem, LuceneQuery>(this, this.QueryMapper, this.QueryOptimizer, this.FieldNameTranslator);

            (queryable as IHasTraceWriter).TraceWriter = (this as IHasTraceWriter).TraceWriter;

            var filters = GetTypeInheritance(typeof(TItem)).SelectMany(t => t.GetCustomAttributes(typeof(IPredefinedQueryAttribute), true).Cast <IPredefinedQueryAttribute>()).ToList();

            foreach (IPredefinedQueryAttribute filter in filters)
            {
                queryable = filter.ApplyFilter(queryable, this.ValueFormatter);
            }

            return(queryable);
        }