예제 #1
0
        public void replication()
        {
            mongo.DeleteAllRecords <RouterModel>("router");
            CountryModel country = new CountryModel {
                Name = "TestCountry"
            };
            CompanyModel company = new CompanyModel {
                Name = "TestCompany"
            };
            EncriptionModel encription = new EncriptionModel {
                Name = "TestEncription"
            };
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            for (int i = 0; i < 1000; i++)
            {
                Insert(new RouterModel
                {
                    Name       = "Test",
                    Antennas   = 4,
                    Mac        = "Test",
                    Company    = company,
                    Country    = country,
                    Encription = encription
                });
            }
            stopwatch.Stop();
            Console.WriteLine($"Insert time is {stopwatch.ElapsedMilliseconds}");
            stopwatch.Start();
            mongo.LoadRecords <RouterModel>("router");
            stopwatch.Stop();
            Console.WriteLine($"Select time is {stopwatch.ElapsedMilliseconds}");
        }
예제 #2
0
        public void MigrateEncryption()
        {
            //get all encriptions from sql database
            var encriptions = dao.GetAllEncryptions();

            List <EncriptionModel> encrModels = new List <EncriptionModel>(encriptions.Count);

            //adding encr models to list
            foreach (var encr in encriptions)
            {
                var encrModel = new EncriptionModel {
                    Name = encr.EncryptionName
                };
                encrModels.Add(encrModel);
            }

            //inserting encr from list to mongo
            foreach (var enc in encrModels)
            {
                mongo.InsertRecord <EncriptionModel>("encryptiontype", enc);
            }
        }