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); }
public IQueryable <T> Query <T>(ILoadingStrategy <T> loadingStrategy = null, StaleResultsMode staleResults = StaleResultsMode.AllowStaleResultsMode) { return(_outsideSession.Query(loadingStrategy, staleResults)); }
public T GetById <T>(ValueType id, ILoadingStrategy <T> loadingStrategy = null) { return(_outsideSession.GetById(id, loadingStrategy)); }
public T[] GetByIds <T>(IEnumerable <string> ids, ILoadingStrategy <T> loadingStrategy = null) { return(_outsideSession.GetByIds <T>(ids, loadingStrategy)); }
public T GetById <T>(ValueType id, ILoadingStrategy <T> loadingStrategy = null) { var loader = ApplyLoadingStrategyToSession(Session, loadingStrategy); return(loader == null?Session.Load <T>(id) : loader.Load(id)); }
public T[] GetByIds <T>(IEnumerable <string> ids, ILoadingStrategy <T> loadingStrategy = null) { var loader = ApplyLoadingStrategyToSession(Session, loadingStrategy); return(loader == null?Session.Load <T>(ids) : loader.Load(ids.ToArray())); }
private static IRavenQueryable <T> ApplyLoadingStrategyToQuery <T>(IRavenQueryable <T> query, ILoadingStrategy <T> strategy) { var loadingStrategy = (LoadingStrategy <T>)strategy; if (loadingStrategy == null || loadingStrategy.IsEmpty) { return(query); } return(query.Customize(x => { var property = loadingStrategy.Dequeue(); x.Include(property); while (!loadingStrategy.IsEmpty) { property = loadingStrategy.Dequeue(); x.Include(property); } })); }
private static ILoaderWithInclude <T> ApplyLoadingStrategyToSession <T>(IDocumentSession session, ILoadingStrategy <T> strategy) { var loadingStrategy = (LoadingStrategy <T>)strategy; if (loadingStrategy == null || loadingStrategy.IsEmpty) { return(null); } var property = loadingStrategy.Dequeue(); var loaderWithInclude = session.Include(property); while (!loadingStrategy.IsEmpty) { property = loadingStrategy.Dequeue(); loaderWithInclude = session.Include(property); } return(loaderWithInclude); }