示例#1
0
        public void Run()
        {
            Siaqodb siaqodb = SiaqodbFactoryExample.GetInstance();
            siaqodb.DropType<ClassWithIndex>();//all objects of this Type will be deleted from database

            for (int i = 0; i < 10000; i++)
            {
                ClassWithIndex myobj = new ClassWithIndex() { MyID = i % 10, Name = "MyTest" + i.ToString() };

                siaqodb.StoreObject(myobj);
            }
            DateTime start = DateTime.Now;
            var q = from ClassWithIndex myobj in siaqodb
                    where myobj.MyID == 8//index will be used so very fast retrieve from DB
                    select myobj;
            int k = 0;
            foreach (ClassWithIndex obj in q)
            {
                //do something with object
                k++;
            }
            string timeElapsed = (DateTime.Now - start).ToString();

            Log("Time elapsed to load:" + k.ToString() + " objects from 10.000 stored objects filtered by index:" + timeElapsed);
        }
示例#2
0
        public void Run()
        {
            Siaqodb siaqodb = SiaqodbFactoryExample.GetInstance();

            siaqodb.DropType <ClassWithIndex>();//all objects of this Type will be deleted from database

            for (int i = 0; i < 10000; i++)
            {
                ClassWithIndex myobj = new ClassWithIndex()
                {
                    MyID = i % 10, Name = "MyTest" + i.ToString()
                };

                siaqodb.StoreObject(myobj);
            }
            DateTime start = DateTime.Now;
            var      q     = from ClassWithIndex myobj in siaqodb
                             where myobj.MyID == 8//index will be used so very fast retrieve from DB
                             select myobj;
            int k = 0;

            foreach (ClassWithIndex obj in q)
            {
                //do something with object
                k++;
            }
            string timeElapsed = (DateTime.Now - start).ToString();

            Log("Time elapsed to load:" + k.ToString() + " objects from 10.000 stored objects filtered by index:" + timeElapsed);
        }