public async Task Migrate() { if (appSettings.IsMigrated) return; try { VideoDataContext ctx = new VideoDataContext(); SQLiteAsyncConnection con = CreateConnection(); await con.InsertAllAsync(await ctx.Ranges.GetAllAsync()); await ctx.Ranges.DropAsync(); await con.InsertAllAsync(await ctx.Videos.GetAllAsync()); await ctx.Ranges.DropAsync(); } catch (Exception ex) { Tracing.Trace("DbService.Migration {0}", ex.Message); //TODO: Log } finally { appSettings.IsMigrated = true; } }
public HomeController(ILogger <HomeController> logger, VideoDataContext context) { _logger = logger; this._db = context; }