コード例 #1
0
ファイル: DbService.cs プロジェクト: Ontropix/slow-camera
        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;
            }
        }
コード例 #2
0
 public HomeController(ILogger <HomeController> logger, VideoDataContext context)
 {
     _logger  = logger;
     this._db = context;
 }