Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // reference Npgsql NuGet package 3.0 in project
- using Npgsql;
- using NpgsqlTypes;
- // register provider with name 3-0, could also just do a assembly binding redirect
- DbProvider.RegisterDbMetadata("Npgsql-30", new DbMetadata
- {
- AssemblyName = typeof(NpgsqlConnection).Assembly.FullName,
- BindByName = true,
- ConnectionType = typeof(NpgsqlConnection),
- CommandType = typeof(NpgsqlCommand),
- ParameterType = typeof(NpgsqlParameter),
- CommandBuilderType = typeof(NpgsqlCommandBuilder),
- ParameterDbType = typeof(NpgsqlDbType),
- ParameterDbTypePropertyName = "NpgsqlDbType",
- ParameterNamePrefix = ":",
- ExceptionType = typeof(NpgsqlException),
- UseParameterNamePrefixInParameterCollection = true
- });
- var properties = new NameValueCollection
- {
- ["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz",
- ["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz",
- ["quartz.jobStore.dataSource"] = "default",
- ["quartz.dataSource.default.connectionString"] = "Server=127.0.0.1;Port=5432;Userid=postgres;Password=postgres;Pooling=true;MinPoolSize=1;MaxPoolSize=20;Timeout=15;SslMode=Disable;Database=quartz",
- ["quartz.dataSource.default.provider"] = "Npgsql-30"
- };
- ISchedulerFactory sf = new StdSchedulerFactory(properties);
- IScheduler sched = sf.GetScheduler();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement