/// <summary> /// Saves the player stats three times, using a collection of PlayerStats and inserting all at once. This example uses /// transactions which can vastly reduce the amount of time spent updating data when you have a lot of records to insert. /// </summary> /// <param name='playerName'> /// Player name. /// </param> /// <param name='totalKills'> /// Total kills. /// </param> /// <param name='points'> /// Points. /// </param> private void SavePlayerStats_SimpleThreeTimes(string playerName, int totalKills, int points) { // set up our playerStats variable to store data PlayerStats playerStats; // set up our collection of playerStats to pass to the database List <PlayerStats> playerStatsCollection = new List <PlayerStats>(); // add player stats to the collection playerStats = new PlayerStats { PlayerName = playerName, TotalKills = totalKills, Points = points }; playerStatsCollection.Add(playerStats); // add player stats to the collection playerStats = new PlayerStats { PlayerName = playerName, TotalKills = totalKills, Points = points }; playerStatsCollection.Add(playerStats); // add player stats to the collection playerStats = new PlayerStats { PlayerName = playerName, TotalKills = totalKills, Points = points }; playerStatsCollection.Add(playerStats); // insert all the player stats at one time by passing the collection dbManager.InsertAll(playerStatsCollection); }