Open p10tyr opened 9 years ago
try:
builder.Register(c =>
{
IAsyncDocumentSession session = documentStore.OpenAsyncSession()
session.Advanced.UseOptimisticConcurrency = true;
return session;
}).As().InstancePerHttpRequest();
Ahh Great. Thanks for the tip. I was unsure on how to do that. I was looking at Property Injection, AutoWire Types and stuff. I will remember now that I can use {} in Lambas like that. Very Usefull.
This is the compilable solution.
builder.Register(c =>
{
IAsyncDocumentSession session = c.Resolve<IDocumentStore>().OpenAsyncSession();
session.Advanced.UseOptimisticConcurrency = true;
return session;
})
.As<IAsyncDocumentSession>() .InstancePerHttpRequest();
I upgraded to RavenDB 3 and updated to Identity PRE6
You suggest this
IDocumentStore documentStore = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "AspNetIdentity" }.Initialize();
using (IAsyncDocumentSession session = documentStore.OpenAsyncSession()) { session.Advanced.UseOptimisticConcurrency = true; RavenUserStore ravenUserStore = new RavenUserStore(session);
UserManager userManager = new UserManager(ravenUserStore);
}
But I am using AutoFAC and I get the error: Optimistic concurrency disabled 'IAsyncDocumentSession' instance is not supported be......
On this line. How Do I set what is needed?
builder.Register(c => new RavenUserStore(c.Resolve(), false)).As<IUserStore>().InstancePerHttpRequest();
So the setting is on this line in autofac
builder.Register(c => c.Resolve().OpenAsyncSession()).As().InstancePerHttpRequest();
But how can I set .Advanced.UseOptimisticConcurrency = true ?