Пример #1
0
        public TestMongoDb(ITestOutputHelper output)
        {
            MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Tests\mongodbconfig.json");

            this.context = new MediaRecordMongoDatabaseContext(mongoDbConfig);
            manager      = new ImageMongoDbManager(context);
            this.output  = output;
        }
        public static ImageService GetImageService(BlobStorageConfig blobStorageConfig, MongoDbConfig mongoDbConfig)
        {
            BlobStorage    blobStorage    = new BlobStorage(blobStorageConfig);
            ImageProcessor imageProcessor = new ImageProcessor();
            //ImageDBManager imageDBManager = new ImageDBManager
            //    (new MediaRecordDatabaseContext());
            MediaRecordMongoDatabaseContext mongoDbContext = new MediaRecordMongoDatabaseContext(mongoDbConfig);
            ImageMongoDbManager             imageDBManager = new ImageMongoDbManager(mongoDbContext);

            Core.ImageService imageService = new Core.ImageService(
                blobStorageConfig, imageProcessor, blobStorage, imageDBManager);
            return(imageService);
        }
Пример #3
0
        static void TestMongoModelGetIdByMD5()
        {
            MediaRecordMongoDatabaseContext context;
            ImageMongoDbManager             manager;
            MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Core\DBManager\resource\mongodbconfig.json");

            context = new MediaRecordMongoDatabaseContext(mongoDbConfig);
            manager = new ImageMongoDbManager(context);

            String str = manager.GetIdByMD5(0xdead);

            str = manager.GetIdByMD5(123);
            Console.WriteLine(str);
        }
Пример #4
0
        static void TestMongoModel()
        {
            MediaRecordMongoDatabaseContext context;
            ImageMongoDbManager             manager;
            MongoDbConfig mongoDbConfig = MongoDbConfig.GetMongoDbConfig(@"C:\Users\t-chwang\source\repos\ImageServingPlatform\Core\DBManager\resource\mongodbconfig.json");

            context = new MediaRecordMongoDatabaseContext(mongoDbConfig);
            manager = new ImageMongoDbManager(context);

            Image image = new Image {
                Width = 500, Height = 500, BlobName = "Shit", MD5 = 123
            };

            image = manager.Create(image);
            Console.WriteLine(image.Id);
        }