public override async Task RunAsync() { int liveRoomCount = await Collector.CollectRoomCountAsync("0").ConfigureAwait(true); ShowLogInfo(liveRoomCount.ToString()); var item = BilibiliLiveRoomCount.Create(liveRoomCount); using var context = new BilibiliDbContext(DbConfig); context.Database.EnsureCreated(); context.LiveRoomCount.Add(item); await context.SaveChangesAsync(); }
public override async Task RunAsync() { Collector.BeforeCollectAsync(); int liveRoomCount = await Collector.CollectAsync("0"); ShowLogInfo(liveRoomCount.ToString()); using (var context = new BilibiliLiveRoomCountMySqlContext()) { context.Database.EnsureCreated(); var item = BilibiliLiveRoomCount.Create(liveRoomCount); context.LiveRoomCount.Add(item); context.SaveChanges(); } }