public void Configuration(IAppBuilder app)
        {
            // ConfigureAuth(app);
            app.Use <GlobalExceptionMiddleware>();
            // Hangfire configuration
            var options = new SQLiteStorageOptions();

            GlobalConfiguration.Configuration.UseSQLiteStorage("SQLiteHangfire", options);
            var option = new BackgroundJobServerOptions {
                WorkerCount = 1
            };

            app.UseHangfireServer(option);
            app.UseHangfireDashboard();

            var boardData = File.ReadAllText("pie.json");
            var settings  = new JsonSerializerSettings();

            settings.Converters.Add(new DatasetFieldConverter());

            using (JsonReader reader = new JsonTextReader(new StringReader(boardData)))
            {
                var array = JArray.Load(reader);
                foreach (var job in array)
                {
                    string value      = job.ToString(Formatting.None);
                    var    typedBoard = JsonConvert.DeserializeObject <ConfigurationDataset>(value);
                    RecurringJob.AddOrUpdate(typedBoard.DataSetName, () => Run(typedBoard), Cron.MinuteInterval(typedBoard.PollInterval), TimeZoneInfo.Utc);
                }
            }
        }
        public void Start()
        {
            _logger.Info("IISLogReader Windows Service starting");
            IAppSettings appSettings = new AppSettings();

            // make sure the data directory exists
            Directory.CreateDirectory(appSettings.DataDirectory);

            _logger.Info("Starting Nancy host");
            var hostConfiguration = new HostConfiguration
            {
                UrlReservations = new UrlReservations()
                {
                    CreateAutomatically = true
                }
            };

            string url = String.Format("http://localhost:{0}", appSettings.Port);

            _host = new NancyHost(hostConfiguration, new Uri(url));
            _host.Start();

            // fire up the background job processor
            _logger.Info("Starting background job server");
            var    sqlLiteOptions = new SQLiteStorageOptions();
            string connString     = String.Format("Data Source={0}\\Data\\IISLogReaderJobs.db;Version=3;", AppDomain.CurrentDomain.BaseDirectory);

            GlobalConfiguration.Configuration.UseSQLiteStorage(connString, sqlLiteOptions);
            GlobalConfiguration.Configuration.UseActivator(new WebConsoleJobActivator());
            var jobServerOptions = new BackgroundJobServerOptions {
                WorkerCount = 1
            };

            _jobServer = new BackgroundJobServer(jobServerOptions);
        }
        public void Set_QueuePollInterval_ShouldThrowAnException_WhenGivenIntervalIsNegative()
        {
            var options = new SQLiteStorageOptions();

            Assert.Throws <ArgumentException>(
                () => options.QueuePollInterval = TimeSpan.FromSeconds(-1));
        }
        public void Set_QueuePollInterval_ShouldThrowAnException_WhenGivenIntervalIsEqualToZero()
        {
            var options = new SQLiteStorageOptions();

            Assert.Throws <ArgumentException>(
                () => options.QueuePollInterval = TimeSpan.Zero);
        }
示例#5
0
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            var name = String.Format(
                "{0}.{1}",
                Environment.MachineName,
                Guid.NewGuid().ToString());
            var options = new SQLiteStorageOptions();

            GlobalConfiguration.Configuration.UseSQLiteStorage("SQLiteHangfire", options);
            var option = new BackgroundJobServerOptions
            {
                ServerName              = name,
                WorkerCount             = 1,
                SchedulePollingInterval = TimeSpan.FromMinutes(1),
                Queues = new[] { "run", "delete", "deletefile" }
            };

            QueueAttribute queue = new QueueAttribute("run");

            RecurringJob.AddOrUpdate("run", () => Run(), "* * * * *", queue: "run");
            RecurringJob.AddOrUpdate("delete", () => Delete(), "0 0 1 */6 *", queue: "delete");
            RecurringJob.AddOrUpdate("deletefile", () => DeleteFile(), "0 0 * * *", queue: "deletefile");

            app.UseHangfireDashboard();
            app.UseHangfireServer(option);
        }
        public void Ctor_SetsTheDefaultOptions()
        {
            SQLiteStorageOptions storageOptions = new SQLiteStorageOptions();

            Assert.Equal("hangfire", storageOptions.Prefix);
            Assert.True(storageOptions.InvisibilityTimeout > TimeSpan.Zero);
        }
示例#7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <TriggrContext>(i =>
            {
                i.UseSqlite(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Triggr.UI"));
            });


            services.AddMvc();
            //.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            //.AddGitHubWebHooks();

            services.AddHangfire(i =>
            {
                var options = new SQLiteStorageOptions();
                i.UseSQLiteStorage(Configuration.GetConnectionString("HangfireConnection"), options);
                i.UseActivator(new HangfireActivator(services));
                i.UseConsole();
            });

            var config = Configuration.GetSection("TriggrConfig");
            var email  = Configuration.GetSection("EmailConfig");

            services.Configure <Triggr.TriggrConfig>(config);

            services.Configure <Triggr.EmailConfig>(email);

            services.AddTriggr();
        }
        public void Set_QueuePollInterval_SetsTheValue()
        {
            var options = new SQLiteStorageOptions {
                QueuePollInterval = TimeSpan.FromSeconds(1)
            };

            Assert.Equal(TimeSpan.FromSeconds(1), options.QueuePollInterval);
        }
        public void Ctor_SetsTheDefaultOptions()
        {
            var options = new SQLiteStorageOptions();

            Assert.True(options.QueuePollInterval > TimeSpan.Zero);
            Assert.True(options.InvisibilityTimeout > TimeSpan.Zero);
            Assert.True(options.JobExpirationCheckInterval > TimeSpan.Zero);
            Assert.True(options.PrepareSchemaIfNecessary);
        }
        public void Ctor_SetsTheDefaultOptions_ShouldGenerateUniqueClientId()
        {
            var storageOptions1 = new SQLiteStorageOptions();
            var storageOptions2 = new SQLiteStorageOptions();
            var storageOptions3 = new SQLiteStorageOptions();

            IEnumerable <string> result = new[] { storageOptions1.ClientId, storageOptions2.ClientId, storageOptions3.ClientId }.Distinct();

            Assert.Equal(3, result.Count());
        }
示例#11
0
        public void ConfigureServices(IServiceCollection services)
        {
            GeneratedDependencies.ConfigureGeneratedServices(services);
            var options = new SQLiteStorageOptions();

            services.AddDbContext <EventStoreContext>(option => option.UseSqlite(Configuration.GetConnectionString("EventStoreDatabase")));
            services.AddDbContext <HangfireContext>(option => option.UseSqlite(Configuration.GetConnectionString("HangfireDatabase")));
            services.AddHangfire(configuration =>
                                 GlobalConfiguration.Configuration.UseSQLiteStorage(Configuration.GetConnectionString("HangfireDatabase"), options))
            .AddMvc();
        }
示例#12
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <MyDbContex>(options => options.UseSqlite("data source = " + "Db" + "/" + "TestWeb.db"));
            var sqliteOptions = new SQLiteStorageOptions();

            SQLitePCL.Batteries.Init();
            services.AddHangfire(configuration => configuration
                                 .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                                 .UseSimpleAssemblyNameTypeSerializer().UseRecommendedSerializerSettings()
                                 .UseLogProvider(new ColouredConsoleLogProvider())
                                 .UseSQLiteStorage("Data Source=./Db/Hangfire.db;", sqliteOptions)
                                 );
            services.AddRazorPages();
        }
示例#13
0
        public static IServiceCollection AddHangfire(this IServiceCollection services, IConfiguration configuration)
        {
            var sqliteStorageOptions = new SQLiteStorageOptions
            {
                InvisibilityTimeout = TimeSpan.FromMinutes(5)
            };

            return(services
                   .AddHangfire(c => c
                                .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                                .UseSimpleAssemblyNameTypeSerializer()
                                .UseRecommendedSerializerSettings()
                                .UseSQLiteStorage(configuration.GetConnectionString("HangfireConnection"), sqliteStorageOptions))
                   .AddHangfireServer(o => o.WorkerCount = 8));
        }
示例#14
0
        public static SQLiteStorage GetSqliteStorage()
        {
            var connectionString = BotSettings.HangfireSqliteDb;

            Log.Information($"HangfireSqlite: {connectionString}");

            var options = new SQLiteStorageOptions()
            {
                QueuePollInterval = TimeSpan.FromSeconds(10)
            };

            var storage = new SQLiteStorage(connectionString, options);

            return(storage);
        }
示例#15
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var SQLiteOptions = new SQLiteStorageOptions()
            {
                SchemaName = "HangFireSchema",
            };

            services.AddHangfire(config => config
                                 .UseSimpleAssemblyNameTypeSerializer()
                                 .UseRecommendedSerializerSettings()
                                 .UseSQLiteStorage("Filename=./Hangfire.db;", SQLiteOptions));
            services.AddHangfireServer();

            services.AddControllers();
        }
示例#16
0
    public static SQLiteStorage GetSqliteStorage(string connectionString)
    {
        Log.Information("HangfireSqlite: {ConnectionString}", connectionString);

        connectionString.EnsureDirectory();

        var options = new SQLiteStorageOptions()
        {
            QueuePollInterval = TimeSpan.FromSeconds(10)
        };

        var storage = new SQLiteStorage(connectionString, options);

        return(storage);
    }
示例#17
0
        public void Configuration(IAppBuilder app)
        {
            // Hangfire configuration
            var options = new SQLiteStorageOptions();

            //string DBPath = @"./db/hangfire.db;Version=3;";
            //Data Source=C:\SQLITEDATABASES\SQLITEDB1.sqlite;Version=3;");

            //string liteStr = "Data Source=" + DBPath;
            GlobalConfiguration.Configuration.UseSQLiteStorage("SQLiteHangfire", options);
            var option = new BackgroundJobServerOptions {
                WorkerCount = 1
            };

            app.UseHangfireServer(option);
            app.UseHangfireDashboard();

            // Add scheduled jobs
            //Jobs jobs = new Jobs();
            //BatchJobs jobs = new BatchJobs();
            ////    jobs.SendM1Mail();
            //RecurringJob.AddOrUpdate(() => Console.WriteLine("{0} Background job completed successfully!", DateTime.Now.ToString()), Cron.Minutely);

            string      interval = ConfigurationManager.AppSettings["PackCronMin"];
            int         min      = int.Parse(interval);
            JobsManager jobs     = new JobsManager();

            RecurringJob.AddOrUpdate(() => jobs.PackPrint(), Cron.MinuteInterval(min));


            //RecurringJob.AddOrUpdate(() => Console.WriteLine("{0} Background job completed successfully!", DateTime.Now.ToString()), Cron.Monthly(3, 2));
            //RecurringJob.AddOrUpdate(() => jobs.SendMail(1), Cron.Minutely);
            //RecurringJob.AddOrUpdate(() => jobs.SendM1Mail("M1",null,null), Cron.Daily(20));
            // Map Dashboard to the `http://<your-app>/hangfire` URL.
            ////app.UseHangfireDashboard();
            ////app.UseHangfireServer();

            //var options = new DashboardOptions { AppPath = "http://localhost:9999" };

            //app.UseHangfireDashboard("/jobs", options);

            //var options = new DashboardOptions
            //{
            //     AuthorizationFilters =
            //};
            //app.UseHangfireDashboard("/hangfire", options);
        }
示例#18
0
        public SQLiteTagsTransaction(SQLiteStorageOptions options, IWriteOnlyTransaction transaction)
        {
            if (transaction.GetType().Name != "SQLiteWriteOnlyTransaction")
            {
                throw new ArgumentException("The transaction is not an SQLite transaction", nameof(transaction));
            }

            _options     = options;
            _transaction = transaction;

            // Dirty, but lazy...we would like to execute these commands in the same transaction, so we're resorting to reflection for now

            // Other transaction type, clear cached methods
            if (_type != transaction.GetType())
            {
                _acquireSetLock = null;
                _queueCommand   = null;

                _type = transaction.GetType();
            }

            if (_acquireSetLock == null)
            {
                _acquireSetLock = transaction.GetType().GetTypeInfo().GetMethod(nameof(AcquireSetLock),
                                                                                BindingFlags.NonPublic | BindingFlags.Instance);
            }

            if (_acquireSetLock == null)
            {
                throw new ArgumentException("The function AcquireSetLock cannot be found.");
            }

            if (_queueCommand == null)
            {
                _queueCommand = transaction.GetType().GetTypeInfo().GetMethod(nameof(QueueCommand),
                                                                              BindingFlags.NonPublic | BindingFlags.Instance);
            }

            if (_queueCommand == null)
            {
                throw new ArgumentException("The function QueueCommand cannot be found.");
            }
        }
示例#19
0
        private void ConfigureHangfire(IApplicationBuilder app, IWebHostEnvironment env)
        {
            var options = new SQLiteStorageOptions();

            GlobalConfiguration.Configuration.UseSQLiteStorage(databaseConnectionString, options);

            var backgroundJobServerOptions = new BackgroundJobServerOptions
            {
                WorkerCount = Environment.ProcessorCount * 4
            };

            app.UseHangfireServer(backgroundJobServerOptions);
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new HangfireDashboardAuthorizationFilter(env) }
            });

            // RecurringJob.AddOrUpdate(() => Debug.WriteLine($"Done ! {DateTime.Now}"), Cron.Minutely);
        }
示例#20
0
        /// <summary>
        /// Configure Hangfire Connection string, dashboard
        /// </summary>
        /// <param name="appBuilder"></param>
        public void Configuration(Owin.IAppBuilder appBuilder)
        {
            var options = new SQLiteStorageOptions();


            GlobalConfiguration.Configuration.UseSQLiteStorage("SQLiteHangfire", options);

            var option = new BackgroundJobServerOptions
            {
                ServerName              = "Ghelfond",
                WorkerCount             = 1,
                SchedulePollingInterval = TimeSpan.FromMinutes(1)
            };

            appBuilder.UseHangfireDashboard();
            appBuilder.UseHangfireServer(option);

            var jobSvc = new HangFireService();

            jobSvc.ScheduleJobs();
        }
示例#21
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <MyDbContext>(options => options.UseSqlite("data source = " + "Db" + "/" + "TestWeb.db"));
            var sqliteOptions = new SQLiteStorageOptions();

            SQLitePCL.Batteries.Init();
            services.AddHangfire(configuration => configuration
                                 .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                                 .UseSimpleAssemblyNameTypeSerializer().UseRecommendedSerializerSettings()
                                 .UseLogProvider(new ColouredConsoleLogProvider())
                                 .UseSQLiteStorage("Data Source=./Db/Hangfire.db;", sqliteOptions)
                                 );
            services.AddSingleton(new BackgroundJobServerOptions
            {
                WorkerCount = 1,
                ServerName  = "TaskSvcHangfireServer"
            });
            //如果注入的是同一个接口的多个类,通过接口调用是获取的是哪个类的实例?
            //注:默认获取的最后一个类的实例,可以IEnumerable<interface> 获取注入的类型
            services.AddScoped <IDataService, WeaterDataService>();

            services.AddControllers();
        }
示例#22
0
        public void SQLiteStorageTest_SimpleTest()
        {
            var db = new SQLiteStorage <Item1> (filename);

            db.Clear();

            db.Set("2", new Item1 {
                name = "luis", counter = 2, address = "raphael"
            });
            db.Set("1", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("3", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("12", new Item1 {
                name = "name1", counter = 12, address = "address"
            });

            var obj = db.Find(new { counter = 1, name = "xpto" }).FirstOrDefault();

            // db.Get ("1");

            Assert.IsNotNull(obj, "item not found!");
            Assert.IsTrue(obj.name == "xpto", "wrong item!");
            Assert.IsTrue(obj.counter == 1, "wrong item!");

            var obj2 = db.Get("1").Where(i => i.counter == 1 && i.name == "xpto").First();

            Assert.IsNotNull(obj2, "item not found!");
            Assert.IsTrue(obj2.name == "xpto", "wrong item!");
            Assert.IsTrue(obj2.counter == 1, "wrong item!");

            Assert.IsTrue(db.Get("1").Count() == 1, "wrong item count!");
            Assert.IsTrue(db.Get(new string[] { "1", "2" }).Count() == 2, "wrong item count!");

            var details = db.GetDetails("1").First();

            Assert.IsTrue(details.Date.Hour == DateTime.UtcNow.Hour, "wrong date format!");

            db.Clear();

            db.Set("1", new Item1 {
                name = "luis", counter = 1, address = "raphael"
            });
            db.Set("2", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("3", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("4", new Item1 {
                name = "name1", counter = 1, address = "address"
            });

            var list1 = db.Get().ToList();
            var list2 = db.GetAndModify(i => { i.counter = 2; return(true); }).ToList();
            var list3 = db.Get().ToList();

            Assert.IsTrue(list2.Count == 4, "wrong item count!");
            Assert.IsTrue(list2.Sum(i => i.counter) == 8, "wrong item counter (1)!");
            Assert.IsTrue(list3.Sum(i => i.counter) == list2.Sum(i => i.counter), "wrong item counter (2)!");

            db.GetAndModify(i => { i.counter = 0; return(true); }).ToList();
            db.GetAndModify("1", i => { i.counter = 4; return(true); }).Count();
            db.GetAndModify("4", i => { i.counter = 5; return(true); }).Count();
            Assert.IsTrue(db.Get().Sum(i => i.counter) == 9, "wrong item counter (3)!");

            db = new SQLiteStorage <Item1> (filename, SQLiteStorageOptions.KeepItemsHistory());
            db.Clear();
            db.Set("1", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("1", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("1", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.Set("1", new Item1 {
                name = "xpto", counter = 1, address = "xpto"
            });
            db.GetAndModify("1", i => { return(true); }).Count();
            Assert.IsTrue(db.Get().Sum(i => i.counter) == 8, "wrong item count (4)!");

            // parallel tests
            db = new SQLiteStorage <Item1> (filename, SQLiteStorageOptions.UniqueKeys());
            db.Clear();
            // populate db
            for (int i = 0; i < 100; i++)
            {
                db.Set(i.ToString(), new Item1 {
                    name = i.ToString(), counter = 1, address = "xpto"
                });
            }
            // parallel changes
            int loopUpperBound = 10;
            var expectedTotal  = db.Get().Count();
            var expectedValue  = db.Get().Sum(i => i.counter) + loopUpperBound;

            // thread warmup
            System.Threading.Tasks.Parallel.For(0, loopUpperBound, i => System.Threading.Thread.Sleep(0));
            // execute parallel operation
            var pr = System.Threading.Tasks.Parallel.For(0, loopUpperBound, i => db.GetAndModify("10", m => { m.counter += 1; return(true); }).Count());

            Assert.IsTrue(pr.IsCompleted, "parallel error");
            // check results
            var total  = db.Get().Count();
            var newSum = db.Get().Sum(i => i.counter);
            var item   = db.Get("10").FirstOrDefault();

            Assert.IsTrue(total == expectedTotal, "wrong item expectedTotal (Parallel)!");
            Assert.IsTrue(newSum == expectedValue, "wrong item expectedValue (Parallel)! {0} != {1}", newSum, expectedValue);
            Assert.IsTrue(item.counter == (loopUpperBound + 1), "wrong item counter (Parallel)!{0} != {1}", item.counter, (loopUpperBound + 1));

            // final cleanup
            db.Clear();
            db.Shrink();
        }
示例#23
0
 public void Initialize()
 {
     System.Diagnostics.Debug.WriteLine("SQLiteStorageTest.Initialize");
     logDb = new SQLiteStorage <string> (filename, "Log", SQLiteStorageOptions.KeepItemsHistory());
 }
 public SQLiteTagsServiceStorage(SQLiteStorageOptions options)
 {
     _options = options;
 }
示例#25
0
 public SQLiteStorageTest()
 {
     Common.Logging.LogManager.GetCurrentClassLogger().Info("Initialize");
     logDb = new SQLiteStorage <string> (filename, "Log", SQLiteStorageOptions.KeepItemsHistory());
 }
示例#26
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(this.config);
            if (this.env.IsEnvironment("Development"))
            {
                // Here you can set the services implemented only for DEV
            }

            if (!this.env.IsEnvironment("Testing"))
            // Add Swagger reference to the project. Swagger is not needed when testing
            {
                services.ConfigureSwagger();
            }

            // Allow use the API from other origins
            services.ConfigureCors();

            // Set the context to the database
            services.ConfigureContext();

            services.AddHealthChecks();

            // Set Identity
            services.ConfigureIdentity();

            //Configure the Scopes
            services.ConfigureScope();

            // Add certificates
            services.ConfigureCertificate();

            // Configure the authentication system
            services.AddAuthentication()
            .AddJwtBearer(cfg =>
            {
                cfg.TokenValidationParameters = new TokenValidationParameters
                {
                    IssuerSigningKey =
                        new SymmetricSecurityKey(Encoding.UTF8.GetBytes(this.config["jwt:secretKey"])),
                    ValidIssuer      = this.config["jwt:issuer"],
                    ValidateAudience = false,
                    ValidateLifetime = true
                };
            });


            //Configure Mappers
            services.ConfigureMapper();

            // Configure Compression level
            services.Configure <GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);

            // Add Response compression services
            services.AddResponseCompression(options =>
            {
                options.Providers.Add <GzipCompressionProvider>();
                options.EnableForHttps = true;
            });
            // add some healthchecks
            services.AddHealthChecks().AddCheck <ExampleHealthCheck>("exampleHealthCheck")
            .AddSqlite(this.config["ConnectionStrings:seed_dotnetContextConnection"])
            .AddDiskStorageHealthCheck(options => options.AddDrive(@"C:\", minimumFreeMegabytes: 1000))
            .AddPingHealthCheck(options => options.AddHost("www.google.com", 1000));

            services.AddMvc().AddJsonOptions(
                config =>
            {
                config.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            });

            //Versioning of API
            services.AddApiVersioning(o => {
                o.ReportApiVersions = true;
                o.AssumeDefaultVersionWhenUnspecified = true;
                o.DefaultApiVersion = new ApiVersion(1, 0);
            });

            //Add HangFire
            services.AddHangfire(config =>
            {
                var options = new SQLiteStorageOptions
                {
                    PrepareSchemaIfNecessary = true,
                    QueuePollInterval        = TimeSpan.FromMinutes(5)
                };
                config.UseSQLiteStorage(this.config["ConnectionStrings:seed_dotnetContextConnection"], options);
            });
        }
        public static SQLiteStorage CreateStorage()
        {
            var storageOptions = new SQLiteStorageOptions();

            return(CreateStorage(storageOptions));
        }
        public static SQLiteStorage CreateStorage(SQLiteStorageOptions storageOptions)
        {
            var connectionString = GetConnectionString();

            return(new SQLiteStorage(connectionString, storageOptions));
        }
 public SQLiteStorageTest()
 {
     logger.Info("Initialize");
     logDb = new SQLiteStorage <string> (filename, "Log", SQLiteStorageOptions.KeepItemsHistory());
 }
示例#30
0
 public SQLiteStorageFacts()
 {
     _options = new SQLiteStorageOptions { PrepareSchemaIfNecessary = false };
 }
        /// <summary>
        /// Configures Hangfire to use Tags.
        /// </summary>
        /// <param name="configuration">Global configuration</param>
        /// <param name="options">Options for tags</param>
        /// <param name="sqlOptions">Options for sql storage</param>
        /// <returns></returns>
        public static IGlobalConfiguration UseTagsWithSQLite(this IGlobalConfiguration configuration, TagsOptions options = null, SQLiteStorageOptions sqlOptions = null)
        {
            options    = options ?? new TagsOptions();
            sqlOptions = sqlOptions ?? new SQLiteStorageOptions();

            options.Storage = new SQLiteTagsServiceStorage(sqlOptions);

            TagsServiceStorage.Current = options.Storage;

            var config = configuration.UseTags(options);

            return(config);
        }