Does anyone have a code example that follows best practices of using MongoDB Official C# Driver with Ninject in ASP.NET MVC app?
Mine looks like this:
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);
}
}
}
Since this code is singleton, I have a bad feeling about it :|
Thanks