I am using following setting in startup file
services.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(“connection-string”, new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
DisableGlobalLocks = true,
SqlClientFactory = Microsoft.Data.SqlClient.SqlClientFactory.Instance,
}));
I set SqlClientFactory = Microsoft.Data.SqlClient.SqlClientFactory.Instance as i want to use Microsoft.Data,SqlClient instead of System.Data.SqlClient
I also added the package to the .csproject as mentioned on the
https://docs.hangfire.io/en/latest/upgrade-guides/upgrading-to-hangfire-1.8.html
When i run my service i keep getting error that says
Could not load type ‘SqlGuidCaster’ from assembly ‘System.Data.SqlClient, Version=4.6.1.6, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.
This shows it still refers to the System.Data.SqlClient even if i changed the
SqlClientFactory = Microsoft.Data.SqlClient.SqlClientFactory.Instance
Can someone suggest how to fix and connect to the Microsoft.Data.SqlClient instead of this