IReadOnlyList <ICodeFile> ICodeFileCollection.BuildFiles() { using var lightweight = (QuerySession)OpenSession( new SessionOptions { Tracking = DocumentTracking.None, AllowAnyTenant = true }); using var identityMap = (QuerySession)OpenSession( new SessionOptions { Tracking = DocumentTracking.IdentityOnly, AllowAnyTenant = true }); using var dirty = (QuerySession)OpenSession( new SessionOptions { Tracking = DocumentTracking.DirtyTracking, AllowAnyTenant = true }); var options = new SessionOptions { AllowAnyTenant = true }; var connection = options.Initialize(this, CommandRunnerMode.ReadOnly); using var readOnly = new QuerySession(this, options, connection); return(Options.CompiledQueryTypes.SelectMany(x => new ICodeFile[] { new CompiledQueryCodeFile(x, this, QueryCompiler.BuildPlan(lightweight, x, Options), DocumentTracking.None), new CompiledQueryCodeFile(x, this, QueryCompiler.BuildPlan(identityMap, x, Options), DocumentTracking.IdentityOnly), new CompiledQueryCodeFile(x, this, QueryCompiler.BuildPlan(dirty, x, Options), DocumentTracking.DirtyTracking), new CompiledQueryCodeFile(x, this, QueryCompiler.BuildPlan(readOnly, x, Options), DocumentTracking.QueryOnly) }).ToList()); }
public IQuerySession QuerySession(SessionOptions options) { var connection = options.Initialize(this, CommandRunnerMode.ReadOnly); var session = new QuerySession(this, options, connection); session.Logger = _logger.StartSession(session); return(session); }
public IQuerySession QuerySession(string tenantId) { var options = new SessionOptions { TenantId = tenantId }; var connection = options.Initialize(this, CommandRunnerMode.ReadOnly); var session = new QuerySession(this, options, connection); return(session); }
private IDocumentSession openSession(SessionOptions options) { var connection = options.Initialize(this, CommandRunnerMode.Transactional); IDocumentSession session = options.Tracking switch { DocumentTracking.None => new LightweightSession(this, options, connection), DocumentTracking.IdentityOnly => new IdentityMapDocumentSession(this, options, connection), DocumentTracking.DirtyTracking => new DirtyCheckingDocumentSession(this, options, connection), _ => throw new ArgumentOutOfRangeException(nameof(SessionOptions.Tracking)) }; return(session); }
public IQuerySession QuerySession(SessionOptions options) { var connection = options.Initialize(this, CommandRunnerMode.ReadOnly); return(new QuerySession(this, options, connection)); }