Exemplo n.º 1
0
        private static void MongoPrintTest()
        {
            Stopwatch sw1 = new Stopwatch();

            sw1.Start();
            MongoDBDataContext mongoDataContext = new MongoDBDataContextFactory().CreateDataContext(_config["ConnectionStrings:MongoDB"], "phone_list_dw_sep");

            sw1.Stop();
            Console.WriteLine(mongoDataContext.Database.Name);
            mongoDataContext.Database.Collections.ForEach(c =>
            {
                Console.WriteLine("\t|" + c.Name);

                c.Keys.ForEach(k =>
                {
                    Console.WriteLine("\t\t|Key:" + k.Name);
                });
                c.Indexes.ForEach(i =>
                {
                    Console.WriteLine("\t\t|Index on: " + i.OnKeyIdentifiers.Aggregate((i1, i2) => i1 + "," + i2));
                });
            });

            Console.WriteLine(sw1.ElapsedMilliseconds);
        }
Exemplo n.º 2
0
        private static void MongoTimeTest(int iterations)
        {
            Stopwatch   sw    = new Stopwatch();
            List <long> times = new List <long>();

            for (int i = 0; i < iterations; i++)
            {
                sw.Start();
                MongoDBDataContext mongoDataContext = new MongoDBDataContextFactory().CreateDataContext(_config["ConnectionStrings:MongoDB"], "phone_list_dw_sep");
                sw.Stop();
                times.Add(sw.ElapsedMilliseconds);
                sw.Reset();
            }

            times.ForEach(t => Console.WriteLine(t));
        }
Exemplo n.º 3
0
 private static void MongoOneOff()
 {
     MongoDBDataContext mongoDataContext = new MongoDBDataContextFactory().CreateDataContext(_config["ConnectionStrings:MongoDB"], "phone_list_dw_sep");
 }