示例#1
0
        public MongoDBTemperatureService(IWSNDatabaseSettings settings)
        {
            // Setting up the connection to the database
            MongoClient    mongoDbClient = new MongoClient(settings.DBConnectionString);     // connect to the MongoDB via the DB connection string
            IMongoDatabase databaseData  = mongoDbClient.GetDatabase(settings.DatabaseName); // get the IMongoDatabase object via the MongoDB client via a collection

            // Assign the db values to the readonly value
            this._TempSensorMeasurementDBCollection = databaseData.GetCollection <MongoDBTempModel>(settings.DBCollectionName_Tempature); // get the IMongoCollection object from the IMongoDatabase object
        }
        public MongoDBSmartMeterService(IWSNDatabaseSettings settings)
        {
            // Setting up the connection to the database
            MongoClient    mongoDbClient = new MongoClient(settings.DBConnectionString);     // connect to the MongoDB via the DB connection string
            IMongoDatabase databaseData  = mongoDbClient.GetDatabase(settings.DatabaseName); // get the IMongoDatabase object via the MongoDB client via a collection

            // Assign the db values to the readonly value
            this._SmartMeterMeasurementDBCollection = databaseData.GetCollection <MongoDBDatagramModel>(settings.DBCollectionName_SmartMeter); // get the IMongoCollection object from the IMongoDatabase object

            // Create the parser & processor
            this._SmartMeterParser = new Parser();
            this.processor         = new TelegramProcessor();
        }