builder.RegisterInstance(session).SingleInstance();I don't know autofac, but that is probably wrong, you don't have one session, you have one session per request.On Fri, Apr 1, 2011 at 2:02 PM, Ryan Zec <bas...@gmail.com> wrote:Ok, maybe someone with autofac experience might be able to help be becuase it does not seem to be working.
I updated my Application_Start to add in the session to autofac:
var store = new DocumentStore { Url = "http://localhost:8080" };
store.Initialize();
var session = store.OpenSession();
builder.RegisterInstance(store).SingleInstance();
builder.RegisterInstance(session).SingleInstance();
I then updated my UserRepository constructor to also take in the DocumentSession (left the DocumentStore in there just because but I have tried it without the DocumentStore in there)
public UserRepository(DocumentStore store, DocumentSession session)
I get the following error
Cannot resolve parameter 'Raven.Client.Document.DocumentSession Session' of constructor 'Void .ctor(Raven.Client.Document.DocumentStore, Raven.Client.Document.DocumentSession)'
That error seems like autofac can't find the DocumentSession however I include tit the same way I do for the DocumentStore. Anyone have experience using Autofac with RavenDB?
On Fri, Apr 1, 2011 at 8:44 AM, Ayende Rahien <aye...@ayende.com> wrote:http://www.dotnetguy.co.uk/post/2010/06/12/raven-db-ndash-part-1-ndash-documentsession-per-request-with-structuremap
On Fri, Apr 1, 2011 at 1:41 PM, Ryan Zec <bas...@gmail.com> wrote:What do you mean by "ambient context"? How should I be getting the session?