/// <summary>
/// Initializes a new instance of the <see cref="JobStore"/> class.
/// </summary>
public JobStore()
{
log = LogManager.GetLogger(GetType());
string connectionString;
if( ConfigurationManager.ConnectionStrings["quartznet-mongodb"] != null )
connectionString = ConfigurationManager.ConnectionStrings["quartznet-mongodb"].ConnectionString;
else
connectionString = DefaultConnectionString;
//
// If there is no connection string to use then throw an
// exception to abort construction.
//
if (string.IsNullOrWhiteSpace(connectionString))
throw new ApplicationException("Connection string is missing for the MongoDB job store.");
lock (lockObject)
{
var urlBuilder = new MongoUrlBuilder(connectionString);
var client = new MongoClient(urlBuilder.ToMongoUrl());
this.database = client.GetServer().GetDatabase(urlBuilder.DatabaseName);
}
}