public DatabaseClient(DatabaseConnectionProperties properties)
 {
     _mongoClient    = new MongoClient(properties.ConnectionString);
     _mongoServer    = _mongoClient.GetServer();
     _repository     = _mongoServer.GetDatabase("OPSCallCenterCRM");
     _collectionName = typeof(T).Name;
 }
        public static void StartDatabase(DatabaseConnectionProperties connectionProperties)
        {
            try
            {
                if (!Directory.Exists(DatabasePath))
                {
                    Directory.CreateDirectory(DatabasePath);
                }

                var lockFile = Path.Combine(DatabasePath, "mongod.lock");
                if (File.Exists(lockFile))
                {
                    File.Delete(lockFile);
                }

                var mongoDbProcess = new Process();
                mongoDbProcess.StartInfo.FileName  = ExecutablePath;
                mongoDbProcess.StartInfo.Arguments = string.Format(" --port {0} --dbpath \"{1}\"",
                                                                   connectionProperties.Port,
                                                                   DatabasePath);
                mongoDbProcess.StartInfo.CreateNoWindow         = true;
                mongoDbProcess.StartInfo.RedirectStandardError  = true;
                mongoDbProcess.StartInfo.RedirectStandardOutput = true;
                mongoDbProcess.StartInfo.UseShellExecute        = false;

                mongoDbProcess.Start();
                _databaseExecutablePid = mongoDbProcess.Id;
            }
            catch (Exception) { }
        }
        public static void StartDatabase(DatabaseConnectionProperties connectionProperties)
        {
            try
            {
                if (!Directory.Exists(DatabasePath))
                    Directory.CreateDirectory(DatabasePath);

                var lockFile = Path.Combine(DatabasePath, "mongod.lock");
                if (File.Exists(lockFile))
                    File.Delete(lockFile);

                var mongoDbProcess = new Process();
                mongoDbProcess.StartInfo.FileName = ExecutablePath;
                mongoDbProcess.StartInfo.Arguments = string.Format(" --port {0} --dbpath \"{1}\"",
                                                                   connectionProperties.Port,
                                                                   DatabasePath);
                mongoDbProcess.StartInfo.CreateNoWindow = true;
                mongoDbProcess.StartInfo.RedirectStandardError = true;
                mongoDbProcess.StartInfo.RedirectStandardOutput = true;
                mongoDbProcess.StartInfo.UseShellExecute = false;

                mongoDbProcess.Start();
                _databaseExecutablePid = mongoDbProcess.Id;
            }
            catch (Exception) { }
        }