private void CheckConnection() { if (!Connected) { MongoQueueParams mongoparams = this.connection.specParams as MongoQueueParams; OpenConnection(mongoparams); } }
private void OpenConnection(MongoQueueParams mongoparams) { MongoClient cli = new MongoClient(mongoparams.ConnectionString); var server = cli.GetServer(); var db = server.GetDatabase(mongoparams.Database); Collection = db.GetCollection <MongoQueue.MongoMessage>(mongoparams.Collection); Connected = true; }
public void InitialiseFromModel(RepresentedModel model, QueueConnectionParameters connection) { this.model = model; this.connection = connection; SetSelector(TQItemSelector.DefaultFifoSelector); MongoQueueParams mongoparams = connection.specParams as MongoQueueParams; try { OpenConnection(mongoparams); } catch (Exception e) { throw new QueueConnectionException("can't open connection to: " + mongoparams.ConnectionString, e); } }
private void OpenConnection(MongoQueueParams mongoparams) { MongoClient cli = new MongoClient(mongoparams.ConnectionString); var server = cli.GetServer(); var db = server.GetDatabase(mongoparams.Database); Collection = db.GetCollection<MongoQueue.MongoMessage>(mongoparams.Collection); Connected = true; }