Example #1
0
        private IAsyncDocumentSession OpenAsyncSessionInternal(OpenSessionOptions options)
        {
            AssertInitialized();
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();

            currentSessionId = sessionId;
            try
            {
                var asyncDatabaseCommands = SetupCommandsAsync(AsyncDatabaseCommands, options.Database, options.Credentials, options);
                if (AsyncDatabaseCommands == null)
                {
                    throw new InvalidOperationException("You cannot open an async session because it is not supported on embedded mode");
                }

                var session = new AsyncDocumentSession(options.Database, this, asyncDatabaseCommands, Listeners, sessionId)
                {
                    DatabaseName = options.Database ?? DefaultDatabase ?? MultiDatabase.GetDatabaseName(Url)
                };
                AfterSessionCreated(session);
                return(session);
            }
            finally
            {
                currentSessionId = null;
            }
        }
Example #2
0
        public override IDocumentSession OpenSession(OpenSessionOptions options)
        {
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();

            currentSessionId = sessionId;
            try
            {
                var session = new DocumentSession(this, listeners, sessionId,
                                                  SetupCommands(DatabaseCommands, options.Database, options.Credentials, options)
#if !NET35
                                                  , SetupCommandsAsync(AsyncDatabaseCommands, options.Database, options.Credentials, options)
#endif
                                                  )
                {
                    DatabaseName = options.Database
                };
                AfterSessionCreated(session);
                return(session);
            }
            finally
            {
                currentSessionId = null;
            }
        }
Example #3
0
        public override IDocumentSession OpenSession(OpenSessionOptions options)
        {
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();

            currentSessionId = sessionId;
            try
            {
                var databaseName = options.Database ?? DefaultDatabase ?? MultiDatabase.GetDatabaseName(Url);
                var session      = new DocumentSession(databaseName, this, Listeners, sessionId,
                                                       SetupCommands(DatabaseCommands, databaseName, options.Credentials, options));
                AfterSessionCreated(session);
                return(session);
            }
            finally
            {
                currentSessionId = null;
            }
        }
 public IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
 {
     return Inner.OpenSession(sessionOptions);
 }
 /// <summary>
 ///     Opens the session with the specified options.
 /// </summary>
 public IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
 {
     return server.DocumentStore.OpenSession(sessionOptions);
 }
		/// <summary>
		/// Opens the session with the specified options.
		/// </summary>
		public override IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
		{
			return OpenSessionInternal(sessionOptions.Database, ShardStrategy.Shards.ToDictionary(x => x.Key, x => x.Value.DatabaseCommands
				.ForDatabase(sessionOptions.Database)
				.With(sessionOptions.Credentials)));
		}
Example #7
0
 public override IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
 {
     return OpenAsyncSessionInternal(options);
 }
Example #8
0
        private IAsyncDocumentSession OpenAsyncSessionInternal(OpenSessionOptions options)
        {
            AssertInitialized();
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();
            currentSessionId = sessionId;
            try
            {
                var asyncDatabaseCommands = SetupCommandsAsync(AsyncDatabaseCommands, options.Database, options.Credentials, options);
                if (AsyncDatabaseCommands == null)
                    throw new InvalidOperationException("You cannot open an async session because it is not supported on embedded mode");

                var session = new AsyncDocumentSession(options.Database, this, asyncDatabaseCommands, Listeners, sessionId)
                {
                    DatabaseName = options.Database ?? DefaultDatabase ?? MultiDatabase.GetDatabaseName(Url)
                };
                AfterSessionCreated(session);
                return session;
            }
            finally
            {
                currentSessionId = null;
            }
        }
Example #9
0
 public override IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
 {
     return(OpenAsyncSessionInternal(options));
 }
Example #10
0
 public IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
 {
     return(OpenAsyncSessionInternal(options.Database, SetupCommandsAsync(AsyncDatabaseCommands, options.Database, options.Credentials, options)));
 }
Example #11
0
		public IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
		{
            return OpenAsyncSessionInternal(options.Database, SetupCommandsAsync(AsyncDatabaseCommands, options.Database, options.Credentials, options));
		}
Example #12
0
		public abstract IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions);
Example #13
0
        public IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
        {
            if (!string.IsNullOrWhiteSpace(sessionOptions.Database))
            {
                throw new NotImplementedException("BrnklyDocumentStore does not support opening a session with a database name. The database name must be specified in the constructor.");
            }

            return this.innerStore.OpenSession(sessionOptions);
        }
Example #14
0
        public IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
        {
            if (!string.IsNullOrWhiteSpace(sessionOptions.Database))
            {
                throw GetDatabaseNotSupportedException();
            }

            return this.InnerStore.OpenSession(sessionOptions);
        }
Example #15
0
 private static IAsyncDatabaseCommands SetupCommandsAsync(IAsyncDatabaseCommands databaseCommands, string database, ICredentials credentialsForSession, OpenSessionOptions options)
 {
     if (database != null)
     {
         databaseCommands = databaseCommands.ForDatabase(database);
     }
     if (credentialsForSession != null)
     {
         databaseCommands = databaseCommands.With(credentialsForSession);
     }
     if (options.ForceReadFromMaster)
     {
         databaseCommands.ForceReadFromMaster();
     }
     return(databaseCommands);
 }
Example #16
0
        public override IDocumentSession OpenSession(OpenSessionOptions options)
        {
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();
            currentSessionId = sessionId;
            try
            {
                var session = new DocumentSession(options.Database, this, Listeners, sessionId,
                    SetupCommands(DatabaseCommands, options.Database, options.Credentials, options))
                    {
                        DatabaseName = options.Database ?? DefaultDatabase ?? MultiDatabase.GetDatabaseName(Url)
                    };
                AfterSessionCreated(session);
                return session;
            }
            finally
            {
                currentSessionId = null;
            }
        }
Example #17
0
 private static IAsyncDatabaseCommands SetupCommandsAsync(IAsyncDatabaseCommands databaseCommands, string database, ICredentials credentialsForSession, OpenSessionOptions options)
 {
     if (database != null)
         databaseCommands = databaseCommands.ForDatabase(database);
     if (credentialsForSession != null)
         databaseCommands = databaseCommands.With(credentialsForSession);
     if (options.ForceReadFromMaster)
         databaseCommands.ForceReadFromMaster();
     return databaseCommands;
 }
Example #18
0
		public abstract IDocumentSession OpenSession(OpenSessionOptions sessionOptions);
Example #19
0
 public IDocumentSession OpenSession(OpenSessionOptions sessionOptions)
 {
     throw new NotImplementedException();
 }