コード例 #1
0
ファイル: Program.cs プロジェクト: ChukGPI/ORMBenchmarksTest
        static void Main(string[] args)
        {
            char input;
            AutoMapperConfiguration.Configure();
            do
            {
                ShowMenu();

                input = Console.ReadLine().First();
                switch (input)
                {
                    case 'Q':
                        break;

                    case 'T':
                        List<TestResult> testResults = new List<TestResult>();

                        Console.WriteLine("# of Test Runs:");
                        NumRuns = int.Parse(Console.ReadLine());

                        //Gather Details for Test
                        Console.WriteLine("# of Sports per Run: ");
                        NumSports = int.Parse(Console.ReadLine());

                        Console.WriteLine("# of Teams per Sport: ");
                        NumTeams = int.Parse(Console.ReadLine());

                        Console.WriteLine("# of Players per Team: ");
                        NumPlayers = int.Parse(Console.ReadLine());

                        List<SportDTO> sports = TestData.Generator.GenerateSports(NumSports);
                        List<TeamDTO> teams = new List<TeamDTO>();
                        List<PlayerDTO> players = new List<PlayerDTO>();
                        foreach (var sport in sports)
                        {
                            var newTeams = TestData.Generator.GenerateTeams(sport.Id, NumTeams);
                            teams.AddRange(newTeams);
                            foreach (var team in newTeams)
                            {
                                var newPlayers = TestData.Generator.GeneratePlayers(team.Id, NumPlayers);
                                players.AddRange(newPlayers);
                            }
                        }

                        Database.Reset();
                        Database.Load(sports, teams, players);

                        for (int i = 0; i < NumRuns; i++)
                        {
                            EntityFramework efTest = new EntityFramework();
                            testResults.AddRange(RunTests(i, Framework.EntityFramework, efTest));

                            ADONET adoTest = new ADONET();
                            testResults.AddRange(RunTests(i, Framework.ADONET, adoTest));

                            ADONetReader adoReaderTest = new ADONetReader();
                            testResults.AddRange(RunTests(i, Framework.ADONetDr, adoReaderTest));

                            DataAccess.Dapper dapperTest = new DataAccess.Dapper();
                            testResults.AddRange(RunTests(i, Framework.Dapper, dapperTest));
                        }
                        ProcessResults(testResults);

                        break;
                }

            }
            while (input != 'Q');
        }
コード例 #2
0
        static void Main(string[] args)
        {
            char input;

            AutoMapperConfiguration.Configure();
            do
            {
                ShowMenu();

                input = Console.ReadLine().First();
                switch (input)
                {
                case 'Q':
                    break;

                case 'T':
                    List <TestResult> testResults = new List <TestResult>();

                    Console.WriteLine("# of Test Runs:");
                    NumRuns = int.Parse(Console.ReadLine());

                    //Gather Details for Test
                    Console.WriteLine("# of Sports per Run: ");
                    NumSports = int.Parse(Console.ReadLine());

                    Console.WriteLine("# of Teams per Sport: ");
                    NumTeams = int.Parse(Console.ReadLine());

                    Console.WriteLine("# of Players per Team: ");
                    NumPlayers = int.Parse(Console.ReadLine());


                    List <SportDTO>  sports  = TestData.Generator.GenerateSports(NumSports);
                    List <TeamDTO>   teams   = new List <TeamDTO>();
                    List <PlayerDTO> players = new List <PlayerDTO>();
                    foreach (var sport in sports)
                    {
                        var newTeams = TestData.Generator.GenerateTeams(sport.Id, NumTeams);
                        teams.AddRange(newTeams);
                        foreach (var team in newTeams)
                        {
                            var newPlayers = TestData.Generator.GeneratePlayers(team.Id, NumPlayers);
                            players.AddRange(newPlayers);
                        }
                    }

                    Database.Reset();
                    Database.Load(sports, teams, players);

                    for (int i = 0; i < NumRuns; i++)
                    {
                        EntityFramework efTest = new EntityFramework();
                        testResults.AddRange(RunTests(i, Framework.EntityFramework, efTest));

                        ADONET adoTest = new ADONET();
                        testResults.AddRange(RunTests(i, Framework.ADONET, adoTest));

                        DataAccess.Dapper dapperTest = new DataAccess.Dapper();
                        testResults.AddRange(RunTests(i, Framework.Dapper, dapperTest));
                    }
                    ProcessResults(testResults);

                    break;
                }
            }while (input != 'Q');
        }