/// <summary> /// Opens the session for a particular database with the specified credentials /// </summary> public IDocumentSession OpenSession(string database, ICredentials credentialsForSession) { EnsureNotClosed(); var sessionId = Guid.NewGuid(); currentSessionId = sessionId; try { var session = new DocumentSession(this, listeners, sessionId, DatabaseCommands .ForDatabase(database) .With(credentialsForSession) #if !NET_3_5 , AsyncDatabaseCommands .ForDatabase(database) .With(credentialsForSession) #endif ); AfterSessionCreated(session); return(session); } finally { currentSessionId = null; } }
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; } }
private void AfterSessionCreated(DocumentSession session) { session.Stored += OnSessionStored; foreach (var documentConvertionListener in conversionListeners) { session.Advanced.OnDocumentConverted += documentConvertionListener.DocumentToEntity; session.Advanced.OnEntityConverted += documentConvertionListener.EntityToDocument; } }
/// <summary> /// Opens the session for a particular database /// </summary> public IDocumentSession OpenSession(string database) { var session = new DocumentSession(this, queryListeners, storeListeners, deleteListeners, DatabaseCommands.ForDatabase(database) #if !NET_3_5 , AsyncDatabaseCommands.ForDatabase(database) #endif ); AfterSessionCreated(session); return(session); }
public IDocumentSession OpenSession() { if (DatabaseCommands == null) { throw new InvalidOperationException("You cannot open a session before initialising the document store. Did you forgot calling Initialise?"); } var session = new DocumentSession(this, storeListeners, deleteListeners); session.Stored += OnSessionStored; return(session); }
/// <summary> /// Opens the session with the specified credentials. /// </summary> /// <param name="credentialsForSession">The credentials for session.</param> public IDocumentSession OpenSession(ICredentials credentialsForSession) { var session = new DocumentSession(this, queryListeners, storeListeners, deleteListeners, DatabaseCommands.With(credentialsForSession) #if !NET_3_5 , AsyncDatabaseCommands.With(credentialsForSession) #endif ); AfterSessionCreated(session); return(session); }
public IDocumentSession OpenSession(string database, ICredentials credentialsForSession) { this.EnsureNotClosed(); Guid id = Guid.NewGuid(); DocumentStore.currentSessionId = new Guid?(id); try { DocumentSession documentSession = new DocumentSession(this, this.listeners, id, this.DatabaseCommands.ForDatabase(database).With(credentialsForSession), this.AsyncDatabaseCommands.ForDatabase(database).With(credentialsForSession)); this.AfterSessionCreated((InMemoryDocumentSessionOperations)documentSession); return((IDocumentSession)documentSession); } finally { DocumentStore.currentSessionId = new Guid?(); } }
public IDocumentSession OpenSession() { this.EnsureNotClosed(); Guid id = Guid.NewGuid(); DocumentStore.currentSessionId = new Guid?(id); try { DocumentSession documentSession = new DocumentSession(this, this.listeners, id, this.DatabaseCommands, this.AsyncDatabaseCommands); this.AfterSessionCreated((InMemoryDocumentSessionOperations)documentSession); return((IDocumentSession)documentSession); } finally { DocumentStore.currentSessionId = new Guid?(); } }
public IDocumentSession OpenSession(ICredentials credentialsForSession) { if (DatabaseCommands == null) { throw new InvalidOperationException("You cannot open a session before initialising the document store. Did you forgot calling Initialise?"); } var session = new DocumentSession(this, DatabaseCommands.With(credentialsForSession)); session.Stored += entity => { var copy = Stored; if (copy != null) { copy(Identifier, entity); } }; return(session); }
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; } }
/// <summary> /// Opens the session. /// </summary> /// <returns></returns> public IDocumentSession OpenSession() { EnsureNotClosed(); var sessionId = Guid.NewGuid(); currentSessionId = sessionId; try { var session = new DocumentSession(this, listeners, sessionId, DatabaseCommands #if !NET_3_5 , AsyncDatabaseCommands #endif ); AfterSessionCreated(session); return(session); } finally { currentSessionId = null; } }
/// <summary> /// Initializes a new instance of the <see cref="MultiLoaderWithInclude{T}"/> class. /// </summary> /// <param name="session">The session.</param> public MultiLoaderWithInclude(DocumentSession session) { this.session = session; }
public DocumentQuery(DocumentSession session, IDatabaseCommands databaseCommands, string indexName, string[] projectionFields) : base(session) { this.databaseCommands = databaseCommands; this.projectionFields = projectionFields; this.indexName = indexName; }
protected AbstractDocumentQuery(DocumentSession session) { this.session = session; }