public RobinDataEntities(bool chooser)
        {
            string connectionString = $"metadata=res://*/{dbName}.csdl|res://*/{dbName}.ssdl|res://*/{dbName}.msl;provider=System.Data.SQLite.EF6;data source = {dataSource}";

            Database.Connection.ConnectionString = connectionString;

            Configuration.LazyLoadingEnabled       = false;
            Configuration.AutoDetectChangesEnabled = false;

            Stopwatch Watch = Stopwatch.StartNew();

            Platforms.Include(x => x.Emulators).Load();

            Reporter.Report("Platforms loaded " + Watch.Elapsed.TotalSeconds.ToString("F1") + " s."); Watch.Restart();
            Roms.Load();
            Reporter.Report("Roms loaded " + Watch.Elapsed.TotalSeconds.ToString("F1") + " s."); Watch.Restart();
            Games.Include(x => x.Releases).Load();
            Reporter.Report("Games loaded " + Watch.Elapsed.TotalSeconds.ToString("F1") + " s."); Watch.Restart();
            Regions.Load();
            Reporter.Report("Regions loaded " + Watch.Elapsed.TotalSeconds.ToString("F1") + " s."); Watch.Restart();
            Collections.Include(x => x.Games).Include(x => x.Releases).Load();
            Reporter.Report("Collections loaded " + Watch.Elapsed.TotalSeconds.ToString("F1") + " s."); Watch.Restart();

            foreach (Game game in Games)
            {
                game.Releases = game.Releases.OrderBy(x => x.Region.Priority).ThenByDescending(x => x.Version).ToList();
            }
            Reporter.Report("Games ordered " + Watch.Elapsed.Seconds + " s."); Watch.Restart();
        }
 /// <summary>
 /// Returns a platform given the id of a resource link within the platform.
 /// </summary>
 /// <param name="id">The resource link id.</param>
 /// <returns>The platform.</returns>
 public async Task <Platform> GetPlatformByResourceLinkIdAsync(int id)
 {
     return(await Platforms
            .Include(p => p.ResourceLinks)
            .SingleOrDefaultAsync(p => p.ResourceLinks.Any(l => l.Id == id)));
 }