/// <summary>
/// This method shows the use and the functionality of some repository methods.
/// <c>
/// Insert a new Track in the Database, Count all elements and the Load it all! Then delete a item and Load it all again
/// </c>
/// </summary>
public static void InsertCountLoadAllDeleteAndLoadAgain()
{
ExampleHelper.ExampleMethodPrint("Insert a new Track in the Database, Count all elements and the Load it all!\n"+
"Then delete a item and Load it all again", MethodInfo.GetCurrentMethod());
TrackModel track = new TrackModel(@"..\..\Resource\Garden.mp3");
ExampleHelper.DumpObjectProperties(track.GetAsDatabaseType());
Console.WriteLine("Save Response : " + _trackRep.Save(track));
Console.WriteLine("Count : " + _trackRep.Count<TrackModel.Track>());
List<TrackModel.Track> list = new List<TrackModel.Track>();
Console.WriteLine("GetAll Response : " + _trackRep.GetAll(list));
foreach (TrackModel.Track t in list)
{
ExampleHelper.DumpObjectProperties(t);
}
TrackModel anotherTrack = new TrackModel();
Console.WriteLine("Delete Response: " + _trackRep.Delete<TrackModel.Track>(list.First().Id));
list.Clear();
Console.WriteLine("GetAll Response : " + _trackRep.GetAll(list));
foreach (TrackModel.Track t in list)
{
ExampleHelper.DumpObjectProperties(t);
}
}