//public int SourceFolderId { get; set; } public BackupTask(ServiceOptions options, int sourceFolderId, WebDbContextFactory dbf, ILogger log) { this.options = options; this.log = log; this.dbf = dbf; this.sourceFolderId = sourceFolderId; }
public void WebDbContext_TriodionDays_Test() { var dbContext = WebDbContextFactory.Create(); var result = dbContext.TriodionDayModels.ToList(); Assert.IsTrue(result.Count > 0); }
public void WebDbContext_MenologyRules_Test() { var dbContext = WebDbContextFactory.Create(); var result = dbContext.MenologyRuleModels.ToList(); Assert.IsTrue(result.Count > 0); }
public BackupService(WebDbContextFactory dbf, IOptions <ServiceOptions> option, ILoggerFactory loggerFactory) : base(loggerFactory) { this.options = option.Value; this.dbf = dbf; var serviceSchedule = this.options.ServiceSchedules?.FirstOrDefault(sc => string.Compare(sc.Name, this.GetType().Name) == 0); schedule = serviceSchedule?.Schedule ?? "0 0 1 */12 *";// default is At 00:00 AM, on day 1 of the month, every 12 months!! not useful! BeforeTaskStartsAsync = async(m) => { await OnTaskStart(); }; }
public void WebDbContext_Like_Test() { var dbContext = WebDbContextFactory.Create(); var searchValue = "%С%"; //var filters = new Expression<Func<MenologyRuleGridModel, bool>>[] //{ // m => EF.Functions.Like(m.Name, searchValue), // m => EF.Functions.Like(m.DaysFromEaster, searchValue), //}; var query = new AllMenologyRulesWebQuery(1, ""); var result = dbContext.MenologyRuleModels.WhereAny(query.Search(searchValue)); Assert.IsTrue(result.Count() > 0); }
public ConfigureBackups(ILoggerFactory loggerFactory, WebDbContextFactory dbf, IHostedService hostedService, IOptionsMonitor <ServiceOptions> options) : base(loggerFactory) { //log.LogInformation("Configuration constructor called"); this.dbf = dbf; //dbf.GetWebDbContext<ServiceDb>().Database.EnsureCreated(); this.options = options.CurrentValue; this.schedulerService = hostedService as SchedulerService; options.OnChangeWithDelay((opt) => { this.options = opt; SetupPipeline(); log.LogInformation("Configuration (appsettings) changed, starting ConfigureBackups"); this.schedulerService.ExecuteNow <ConfigureBackups>(); }); var backupSchedule = this.options.ServiceSchedules?.FirstOrDefault(sc => string.Compare(sc.Name, this.GetType().Name) == 0); schedule = backupSchedule?.Schedule ?? "0 0 1 */12 *";// default is At 00:00 AM, on day 1 of the month, every 12 months!! not useful! SetupPipeline(); }