Hi,
I'm building a .NET 6 Blazor app (WebAssembly, Progressive Web App) with an Azure SQL Database.
My LLBLGen version is 5.7.3, and the code is generated for LLBLGen Pro Runtime Framework, Adapter for .NET Standard 2.1.
My issue is related to this thread
I also get the error "The static field 'Instance' of type 'System.Data.SqlClient.SqlClientFactory' is null and therefore this DbProviderFactory can't be used." on this statement.
RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(
c => c.SetTraceLevel(TraceLevel.Verbose)
.AddDbProviderFactory(typeof(SqlClientFactory))
.SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));
System.AggregateException: One or more errors occurred. (The static field 'Instance' of type 'System.Data.SqlClient.SqlClientFactory' is null and therefore this DbProviderFactory can't be used.)
---> SD.LLBLGen.Pro.ORMSupportClasses.ORMConfigurationException: The static field 'Instance' of type 'System.Data.SqlClient.SqlClientFactory' is null and therefore this DbProviderFactory can't be used.
at SD.LLBLGen.Pro.ORMSupportClasses.DQEConfigurationBase.StoreDbProviderFactoryRegistration(Type factoryType, String invariantName)
at SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration.AddDbProviderFactory(Type factoryType, String invariantName)
at Program.<>c.<<Main>$>b__0_1(SQLServerDQEConfiguration c) in C:\_Projects\...\Program.cs:line 29
at SD.LLBLGen.Pro.ORMSupportClasses.RuntimeConfiguration.ConfigureDQE[SQLServerDQEConfiguration](Action`1 configureFunc)
at Program.<Main>$(String[] args) in C:\_Projects\...\Program.cs:line 28
--- End of inner exception stack trace ---
When I debug and navigate to the SqlClientFactory-class, I end up in C:\Users\myuser.nuget\packages\system.data.sqlclient\4.8.3\ref\netcoreapp2.1\System.Data.SqlClient.dll
which looks like a rather empty implementation of this factory.
Trying to register the factory with
DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
causes an ArgumentNullException:* Value cannot be null. (Parameter 'factory')*
But I don't know how to solve the issue in my project with the info from the thread I mentioned.
The problem is possibly not LLBLGen related, but as I find almost no info when I Google (or Bing) the issue, I hope clever LLBLGen-users can help me out here.
Does anyone know how to fix this SqlClientFactory being null?
Kind regards,
Peter