コード例 #1
0
ファイル: Program.cs プロジェクト: ekmadsen/Sandbox
        private static void TestFileSerialization()
        {
            BaseballRepo.UseFile = true;
            IBaseballRepo repo         = new BaseballRepo();
            var           cubs1984Team = repo.CreateTeam();

            PopulateCubs1984Team(repo, cubs1984Team);
            PrintSalaries(cubs1984Team);
            ThreadsafeConsole.WriteLine();
            ThreadsafeConsole.WriteLine();
            cubs1984Team.Save();
            ThreadsafeConsole.WriteLine("Saving team to JSON text file.");
            ThreadsafeConsole.WriteLine("Loading team from JSON text file.");
            ThreadsafeConsole.WriteLine();
            ThreadsafeConsole.WriteLine();
            cubs1984Team = repo.GetTeam(1);
            PrintSalaries(cubs1984Team);
            ThreadsafeConsole.WriteLine();
            ThreadsafeConsole.WriteLine();
            ThreadsafeConsole.WriteLine("Saving team to JSON text file.");
            LeagueRegulations.TeamSalaryCap = 40_000_000m;
            ThreadsafeConsole.WriteLine($"Changing team salary cap to {LeagueRegulations.TeamSalaryCap:C0}.");
            ThreadsafeConsole.WriteLine("Loading team from JSON text file.");
            ThreadsafeConsole.WriteLine();
            ThreadsafeConsole.WriteLine();
            cubs1984Team = repo.GetTeam(1);
            PrintSalaries(cubs1984Team);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ekmadsen/Sandbox
        private static void TestSqlSerialization()
        {
            BaseballRepo.UseFile            = false;
            LeagueRegulations.TeamSalaryCap = 40_000_000m;
            ThreadsafeConsole.WriteLine($"Changing team salary cap to {LeagueRegulations.TeamSalaryCap:C0}.");
            ThreadsafeConsole.WriteLine("Loading team from database.");
            IBaseballRepo repo         = new BaseballRepo();
            var           cubs1984Team = repo.GetTeam(1);

            PrintSalaries(cubs1984Team);
        }