Ejemplo n.º 1
0
            public override async Task RunAsync()
            {
                //Collector.BeforeCollectAsync();
                int liveRoomCount = await Collector.CollectAsync("0").ConfigureAwait(false);

                ShowLogInfo(liveRoomCount.ToString());
                using var context = new BilibiliDbContext(DbConfig);
                context.Database.EnsureCreated();
                var item = BilibiliLiveRoomCount.Create(liveRoomCount);

                context.LiveRoomCount.Add(item);
                context.SaveChanges();
            }
Ejemplo n.º 2
0
            public override async Task RunAsync(LaGouSearchParam searchParam)
            {
                var datas = await Collector.CollectAsync(searchParam).ConfigureAwait(false);

                using var context = new LaGouSqlServerContext();
                context.Database.EnsureCreated();
                int insertCount = 0;

                insertCount = InsertData(context, c => c.Positions, datas.Positions.Values, p => p.PositionId);
                ShowLogInfo($"{nameof(context.Positions)} inserted {insertCount.ToString()}.");
                insertCount = InsertData(context, c => c.Companies, datas.Companies.Values, p => p.CompanyId);
                ShowLogInfo($"{nameof(context.Companies)} inserted {insertCount.ToString()}.");
                insertCount = InsertData(context, c => c.HrInfos, datas.HrInfos.Values, p => p.UserId);
                ShowLogInfo($"{nameof(context.HrInfos)} inserted {insertCount.ToString()}.");
                insertCount = InsertData(context, c => c.HrDailyRecords, datas.HrDailyRecords.Values);
                ShowLogInfo($"{nameof(context.HrDailyRecords)} inserted {insertCount.ToString()}.");
            }