public Game(DateTime when, Sport sport, Team team1, Team team2) { this.when = when; this.sport = sport; this.team1 = team1; this.team2 = team2; }
/// <summary> /// How to insert a complex object in NeoDatis Database /// </summary> public void Step2() { // Create instance Sport volleyball = new Sport("volley-ball"); // Create 4 players Player player1 = new Player("olivier", new DateTime(), volleyball); Player player2 = new Player("pierre", new DateTime(), volleyball); Player player3 = new Player("elohim", new DateTime(), volleyball); Player player4 = new Player("minh", new DateTime(), volleyball); // Create two teams Team team1 = new Team("Paris"); Team team2 = new Team("Montpellier"); // Set players for team1 team1.AddPlayer(player1); team1.AddPlayer(player2); // Set players for team2 team2.AddPlayer(player3); team2.AddPlayer(player4); // Then create a volley ball game for the two teams Game game = new Game(new DateTime(), volleyball, team1, team2); ODB odb = null; try { // Open the database odb = ODBFactory.Open(ODB_NAME); // Store the object odb.Store(game); } finally { if (odb != null) { // Close the database odb.Close(); } } }
public void SetTeam2(Team team2) { this.team2 = team2; }
public void SetTeam1(Team team1) { this.team1 = team1; }