Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Last active April 30, 2019 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/a8739adc72729ffb9570bce57dfa99d8 to your computer and use it in GitHub Desktop.
Save alistairjevans/a8739adc72729ffb9570bce57dfa99d8 to your computer and use it in GitHub Desktop.
MongoDB Lock - Setting Up
public class LockModel
{
// We only need an ID right now
public string Id { get; set; }
}
public class LockProvider
{
private readonly IMongoCollection<LockModel> collection;
public LockProvider(string mongodbConnString)
{
// Create a lock collection
var client = new MongoClient(mongodbConnString);
var database = client.GetDatabase("mydb");
// Get our collection
collection = database.GetCollection<LockModel>("resourceLocks");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment