-
-
Save PureKrome/2372797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace RavenLinqpadDriver | |
{ | |
public class RavenContext : IDocumentSession | |
{ | |
private IDocumentStore _docStore; | |
private IDocumentSession _session; | |
internal TextWriter LogWriter { get; set; } | |
public RavenContext(RavenConnectionInfo connInfo) | |
{ | |
if (connInfo == null) | |
throw new ArgumentNullException("conn", "conn is null."); | |
InitDocStore(connInfo); | |
SetupLogWriting(); | |
// Don't do this.... | |
//_session = _docStore.OpenSession(); | |
} | |
// New Lazy Loaded session. | |
private IDocumentSession Session | |
{ | |
get { return _session ?? (_session = _docStore.OpenSession()); } | |
} | |
// The queries... | |
public IRavenQueryable<T> Query<T, TIndexCreator>() where TIndexCreator : AbstractIndexCreationTask, new() | |
{ | |
return Session.Query<T, TIndexCreator>(); | |
} | |
public IRavenQueryable<T> Query<T>() | |
{ | |
return Session.Query<T>(); | |
} | |
public IRavenQueryable<T> Query<T>(string indexName) | |
{ | |
return Session.Query<T>(indexName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment