예제 #1
0
        private IQueryOver <TEntity, TEntity> GetFilterStrategy <TEntity, TFilter>(
            IFilteringStrategy <TEntity> strategy,
            TFilter filter) where TEntity : class, IHasUid <long> where TFilter : IUserFilter
        {
            IQueryOver <TEntity, TEntity> query = Session.QueryOver <TEntity>();

            strategy.Filtering(query, filter);
            return(query);
        }
예제 #2
0
        public static IQueryOver <TEntity, TEntity> Filtering <TEntity>(
            this IQueryOver <TEntity, TEntity> query, IUserFilter filter)
            where TEntity : IHasUid
        {
            if (_filterStrategyFactory == null)
            {
                throw new ArgumentNullException("FilterStrategyFactory is not initialize");
            }

            IFilteringStrategy <TEntity> strategy = _filterStrategyFactory.Create <TEntity>();

            if (strategy == null)
            {
                throw new ArgumentNullException(
                          string.Format("filter strategy for entity of type '{0}' is not found", typeof(TEntity).FullName));
            }

            return(strategy.Filtering(query, filter));
        }