diff --git a/Sources/App/App.csproj b/Sources/App/App.csproj index 428ab87..3f594df 100644 --- a/Sources/App/App.csproj +++ b/Sources/App/App.csproj @@ -1,12 +1,20 @@  - - Exe - net6.0 - - - - - + + Exe + net6.0 + $(MSBuildProjectDirectory) + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + diff --git a/Sources/App/Program.cs b/Sources/App/Program.cs index feb1b4b..564344e 100644 --- a/Sources/App/Program.cs +++ b/Sources/App/Program.cs @@ -1,12 +1,14 @@ -using Model.Dice; +using Data; +using Data.EF.Players; +using Model.Dice; using Model.Dice.Faces; using Model.Games; using Model.Players; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.Linq; -using Data; namespace App { @@ -14,6 +16,39 @@ namespace App { static void Main(string[] args) { + /* + * the DB stuff and the Model stuff are completely separate here + * + * that will change + */ + + // DB stuff + // if you've run the 'dotnet' 'ef' commands, you should have a DB with 1 table, and 4 players in it + using PlayerDBManager playerDBManager = new(); + + // we'll add a 5th player from the App + PlayerEntity playerEntity = new Player("Ernesto").ToEntity(); + + try + { + playerDBManager.Add(playerEntity); + } // what if there's already a player with that name? Exception (see PlayerEntity's annotations) + catch (ArgumentException ex) { Debug.WriteLine($"{ex.Message}\n... Never mind"); } + catch (Exception ex) { Debug.WriteLine($"{ex.Message}\n... Did you make sure that the DATABASE exists?"); } + + try + { + IEnumerable allPlayersFromDB = playerDBManager.GetAll(); + + foreach (PlayerEntity entity in allPlayersFromDB) + { + Debug.WriteLine(entity); + } + } + catch (Exception ex) { Debug.WriteLine($"{ex.Message}\n... Did you make sure that the DATABASE exists?"); } + + + // Model stuff ILoader loader = new Stub(); GameRunner gameRunner; try diff --git a/Sources/Data/Data.csproj b/Sources/Data/Data.csproj index 7e30ad7..4018f87 100644 --- a/Sources/Data/Data.csproj +++ b/Sources/Data/Data.csproj @@ -1,7 +1,6 @@  - Exe net6.0 enable enable diff --git a/Sources/Data/Program.cs b/Sources/Data/Program.cs deleted file mode 100644 index 32f2755..0000000 --- a/Sources/Data/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Data.EF.Players; -using Model.Players; -using System.Diagnostics; - -namespace Data -{ - internal static class Program - { - static void Main(string[] args) - { - using PlayerDBManager playerDBManager = new(); - try { playerDBManager.Add(new Player("Ernesto").ToEntity()); } - catch (ArgumentException ex) { Debug.WriteLine($"{ex.Message}\n... Never mind"); } - foreach (PlayerEntity entity in playerDBManager.GetAll()) { Debug.WriteLine(entity); } - } - } -} \ No newline at end of file