Esempio n. 1
0
 public static QuartzOptionsBuilder UseMemoryStore(this QuartzOptionsBuilder builder)
 {
     builder.Services.AddSingleton(new UsedMemoryStore());
     builder.Properties.Set("quartz.jobStore.type", "Quartz.Simpl.RAMJobStore, Quartz");
     builder.Properties.Remove("quartz.jobStore.useProperties");
     builder.Properties.Remove("quartz.jobStore.driverDelegateType");
     builder.Properties.Remove("quartz.jobStore.dataSource");
     builder.Properties.Remove("quartz.jobStore.tablePrefix");
     builder.Properties.Remove("quartz.dataSource.myDs.provider");
     builder.Properties.Remove("quartz.dataSource.myDs.connectionString");
     return(builder);
 }
Esempio n. 2
0
 public static QuartzOptionsBuilder UseMySql(this QuartzOptionsBuilder builder, string connectString,
                                             string serializerType = "binary", string tablePrefix = "QRTZ_")
 {
     builder.Properties.Set("quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz");
     builder.Properties.Set("quartz.jobStore.driverDelegateType",
                            "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz");
     builder.Properties.Set("quartz.jobStore.dataSource", "myDs");
     builder.Properties.Set("quartz.dataSource.myDs.provider", "MySql");
     builder.Properties.Set("quartz.jobStore.tablePrefix", tablePrefix);
     builder.Properties.Set("quartz.serializer.type", serializerType);
     builder.Properties.Set("quartz.dataSource.myDs.connectionString", connectString);
     return(builder);
 }
Esempio n. 3
0
        public static IServiceCollection AddQuartz(this IServiceCollection services,
                                                   Action <QuartzOptionsBuilder> optionsAction = null)
        {
            var builder = new QuartzOptionsBuilder
            {
                Services   = services,
                Properties = new NameValueCollection {
                    { "quartz.jobStore.useProperties", "true" }
                }
            };

            optionsAction?.Invoke(builder);

            builder.Services.AddSingleton(provider =>
            {
                LogProvider.SetCurrentLogProvider(provider.GetRequiredService <LoggingProvider>());
                return(provider.GetRequiredService <ISchedulerFactory>().GetScheduler().GetAwaiter().GetResult());
            });
            builder.Services.AddSingleton <ISchedulerFactory>(provider => new StdSchedulerFactory(builder.Properties));
            builder.Services.AddSingleton <LoggingProvider>();
            return(services);
        }
Esempio n. 4
0
 public static QuartzOptionsBuilder UseSchedulerName(this QuartzOptionsBuilder builder, string name)
 {
     builder.Properties.Set("schedName", name);
     return(builder);
 }