I want to test the SQL database features of Quartz.NET 3.0 for .NET Core. Unfortunately, I'm unable to configure the StdSchedulerFactory
properly, I always get the following exception when calling StdSchedulerFactory.GetScheduler
:
System.ArgumentOutOfRangeException:
There is no metadata information for provider 'SqlServer-20'
Parameter name: providerName
at Quartz.Impl.AdoJobStore.Common.DbProvider.GetDbMetadata(String providerName)
at Quartz.Impl.AdoJobStore.Common.DbProvider..ctor(String dbProviderName, String connectionString)
at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__66.MoveNext()
I've configured the factory with the following values:
var configuration = new NameValueCollection
{
{ "quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" },
{ "quartz.jobStore.driverDelegateType", "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" },
{ "quartz.jobStore.tablePrefix", "QRTZ_" },
{ "quartz.jobStore.dataSource", "default" },
{ "quartz.dataSource.default.connectionString", "Server=(localdb)\\mssqllocaldb;Database=QuartzTest;Trusted_Connection=True;MultipleActiveResultSets=true" },
{ "quartz.dataSource.default.provider", "SqlServer-20" },
{ "quartz.jobStore.useProperties", "true" },
{ "quartz.serializer.type", "json" }
};
var schedulerFactory = new StdSchedulerFactory(configuration);
As you can see, I'm currently targeting LocalDB (v12.0.2000). I also checked it on SQL Server Express - same result.
How can I avoid this exception?
tables_sqlServer.sql
script.Currently according to changelog for beta1 there are no versions for providers. So correct provider configuration for SqlServer is:
["quartz.dataSource.sqlserver.provider"] = "SqlServer"
Source: https://github.com/quartznet/quartznet/blob/e3ff6936ea1a76480b7671e2b5c468c1b67f4897/changelog.md#release-30-beta-1-oct-8-2017
A friend of mine just found the answer: according to this example on Github, you have to use SqlServer-41
instead of SqlServer-20
in .NET Core projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With