static void Main(string[] args) { ConfigurationService.Init(); using (var playerDataAccess = new PlayerDataAccess()) { foreach (var player in playerDataAccess.Select()) { Console.WriteLine($"[{player.Number}]{player.FullName}"); } var teamDataAccess = new TeamDataAccess(); var result = teamDataAccess.Select(); playerDataAccess.Insert(new Player { FullName = "Петя", Number = 5, TeamId = result.First().Id }); teamDataAccess.Dispose(); Console.WriteLine(); foreach (var player in playerDataAccess.Select()) { Console.WriteLine($"[{player.Number}]{player.FullName}"); } } }
static void Main(string[] args) { InitConfiguration(); var player = new Player { FullName = "Maks", Number = 23, TeamId = new Guid("7E7E5C30-7B47-4A8E-A4E4-14664A83A55D") }; using (var context = new PlayerDataAccess()) { context.Insert(player); var players = context.Select(); foreach (var plaer in players) { Console.WriteLine($"{plaer.FullName}"); } } }