예제 #1
0
        public IQueryable <T> Query <T>(ILoadingStrategy <T> loadingStrategy = null, StaleResultsMode staleResults = StaleResultsMode.AllowStaleResultsMode)
        {
            var query = Session.Query <T>();

            query = ApplyLoadingStrategyToQuery(query, loadingStrategy);
            query = ApplyNonStaleResultsStrategy(query, staleResults);
            return(query);
        }
예제 #2
0
 public IQueryable <T> Query <T>(ILoadingStrategy <T> loadingStrategy = null, StaleResultsMode staleResults = StaleResultsMode.AllowStaleResultsMode)
 {
     return(_outsideSession.Query(loadingStrategy, staleResults));
 }
예제 #3
0
        private IRavenQueryable <T> ApplyNonStaleResultsStrategy <T>(IRavenQueryable <T> query, StaleResultsMode mode)
        {
            if (mode != StaleResultsMode.WaitForNonStaleResults)
            {
                return(query);
            }

            var whait = _sessionSettings.StaleResultsWhait;

            switch (_sessionSettings.StaleResultWhaitMode)
            {
            case StaleResultWhaitMode.AtNow:
                query = whait.HasValue
                                ? query.Customize(x => x.WaitForNonStaleResultsAsOfNow(whait.Value))
                                : query.Customize(x => x.WaitForNonStaleResultsAsOfNow());
                break;

            case StaleResultWhaitMode.AllNonStale:
                query = whait.HasValue
                                ? query.Customize(x => x.WaitForNonStaleResults(whait.Value))
                                : query.Customize(x => x.WaitForNonStaleResults());
                break;

            case StaleResultWhaitMode.AtLastWrite:
                query = whait.HasValue
                                ? query.Customize(x => x.WaitForNonStaleResultsAsOfLastWrite(whait.Value))
                                : query.Customize(x => x.WaitForNonStaleResultsAsOfLastWrite());
                break;
            }
            return(query);
        }