2. Implement entity cloning using binary serialization Define a function that can clone single entity loaded from the database (for more fame – a graph of entities, starting with from one of the nodes). Test that all properties of the original instance have the same values as the ones on the cloned.
        static void Main()
        {
            DeleteComparer dc = new DeleteComparer();

            //-------first add 100 000  rows in the table
            dc.Insert100000EntitiesInDB();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            dc.BulkDelete();
            sw.Stop();
            Console.WriteLine("Bulk delete time: " + sw.Elapsed);

            //----------------Bulk delete result:  
            //----------------PROFILER: 26 rows; 

            sw.Reset();

            //------ add again 100 000  rows in the table
            dc.Insert100000EntitiesInDB();

            sw.Start();
            dc.NormalDelete();
            sw.Stop();
            Console.WriteLine("Normal delete time: " + sw.Elapsed);

            //----------------Normal delete result:  
            //----------------PROFILER: 3356 rows; 

            Serializator serializator = new Serializator();
            serializator.SerializeDeserialize("Guy");
        }
示例#2
0
        static void Main()
        {
            //DeleteComparer dc = new DeleteComparer();

            ////-------first add 100 000  rows in the table
            //dc.Insert100000EntitiesInDB();

            //Stopwatch sw = new Stopwatch();

            //sw.Start();
            //dc.BulkDelete();
            //sw.Stop();
            //Console.WriteLine("Bulk delete time: " + sw.Elapsed);

            ////----------------Bulk delete result:
            ////----------------PROFILER: 26 rows;
            ////----------------TIME: 00.00.04.6631869

            //sw.Reset();

            ////------ add again 100 000  rows in the table
            //dc.Insert100000EntitiesInDB();


            //sw.Start();
            //dc.NormalDelete();
            //sw.Stop();
            //Console.WriteLine("Normal delete time: " + sw.Elapsed);

            ////----------------Normal delete result:
            ////----------------PROFILER: 3356 rows;
            ////----------------TIME: 00.00.07.0632293


            Serializator serializator = new Serializator();

            serializator.SerializeDeserialize("Guy");
        }