public SampleContext(string databasePassword) { var connectionString = new AppSettingsReader().GetValue("sampleDb", typeof (string)).ToString(); connectionString = connectionString.Replace("{{password}}", databasePassword); var client = new MongoClient(connectionString); _db = client.GetDatabase(connectionString.Split('/').Last()); }