public Entities SelectAll() { Entities result = new Entities(); using (var context = new SPDataContext(SPDataContext.DBConnectionString)) { result.Videos = context.Videos.Cast<VideoMedia>().ToList(); result.Songs = context.Songs.Cast<AudioMedia>().ToList(); result.Albums = context.Albums.Cast<Album>().ToList(); result.Artists = context.Artists.Cast<Artist>().ToList(); result.Playlists = context.Playlists.Cast<Playlist>().ToList(); result.PlaylistsAudioMedia = context.PlaylistsAudioMedia.Cast<PlaylistAudioMedia>().ToList(); } return result; }
private void CheckAndCreateDatabase() { using (var context = new SPDataContext(SPDataContext.DBConnectionString, true)) { if (!context.DatabaseExists()) { ServiceLocator.Current.GetInstance<IApplicationSettingsService>().SetDatabaseVersion(1); context.CreateDatabase(); context.SubmitChanges(); } } }