0
隨着RavenDb
這真是小菜一碟:爲Couchbase客戶端管理DI
public class DataAccessModule : NinjectModule {
public override void Load() {
Bind<IDocumentStore>().ToMethod(
context => {
var documentStore = new EmbeddableDocumentStore {
DataDirectory = @"~/App_Data/database",
UseEmbeddedHttpServer = true
};
return documentStore.Initialize();
}
).InSingletonScope();
Bind<IDocumentSession>().ToMethod(context =>
context.Kernel.Get<IDocumentStore>().OpenSession()
).InRequestScope();
}
}
一個人如何管理的依賴注入Couchbase .NET client
?
Couchbase客戶端沒有類似的工作單元是正確的。建議每個應用程序域中的每個存儲單元保留一個實例。 – 2013-04-22 21:52:14