protected MongoDbRepository([NotNull] MongoDbConnector connector, [NotNull] IEventAggregator eventAggregator,
                                    [NotNull] ILoggerFacade logger) : base(eventAggregator, logger)
        {
            Connector = connector;

            if (!Connector.Connected)
            {
                Connector.Connect();
            }

            _contextLazy = new Lazy <MongoDbContext <TDto, TId> >(CreateContext);
        }
Exemplo n.º 2
0
        public static MongoDbConnector GetServer()
        {
            var lMongoConnector = new MongoDbConnector();

            var processId = SpawnNewProcess(lMongoConnector.DbName, lMongoConnector.Port);

            lMongoConnector.ProcessId = processId;

            if (processId == -1)
            {
                return(lMongoConnector);
            }

            var job = new JobObject();

            job.AddProcess(processId);

            return(lMongoConnector);
        }
Exemplo n.º 3
0
        public static MongoDbConnector GetServer(string dbName, string hostname, int port)
        {
            if (string.IsNullOrEmpty(dbName))
            {
                throw new ArgumentNullException(dbName);
            }

            var lMongoConnector = new MongoDbConnector(dbName, hostname, port);

            var processId = SpawnNewProcess(lMongoConnector.DbName, lMongoConnector.Port);

            lMongoConnector.ProcessId = processId;

            if (processId == -1)
            {
                return(null);
            }

            var job = new JobObject();

            job.AddProcess(processId);

            return(lMongoConnector);
        }
Exemplo n.º 4
0
        protected MongoDbContext([NotNull] MongoDbConnector dbConnector, [NotNull] string collectionName)
        {
            DbConnector = dbConnector;

            SetCollection(collectionName);
        }
Exemplo n.º 5
0
 protected MongoDbContext([NotNull] MongoDbConnector dbConnector)
     : this(dbConnector, typeof(T).Name)
 {
 }