Using MongoDB C# driver 2.4.2, try to establish some reference but getting the err for the last line regarding _db.
"A field initializer cannot reference the non-static field, method or property CurrentClassName._client"
Can't figure it out.
Code:
public class MongoDatabase<T> : ImyDB<T> where T : class, new()
{
private static string _connectionString = ConfigurationManager.ConnectionStrings["db"].ConnectionString;
private string _dbName;
private MongoClient _client = new MongoClient(_connectionString);
private IMongoDatabase _db = _client.GetDatabase(_dbName);