ASP.NET MVCアプリでNinjectでMongoDB公式C#ドライバーを使用するためのベストプラクティスに従うコード例を持っている人はいますか?
私のはこのように見えます:
namespace WebApp
{
public class DataModule : NinjectModule
{
public override void Load()
{
var conventions = new ConventionProfile().SetElementNameConvention(new CamelCaseElementNameConvention());
BsonClassMap.RegisterConventions(conventions, x => true);
var server = MongoServer.Create(connectionString);
var database = server.GetDatabase("webapp");
Bind<MongoDatabase>().ToConstant(database);
}
}
}
このコードはシングルトンなので、私はそれについて悪い感じがします:|
ありがとう