LLBLGEN v4.1 and Blazor Server compatibility

Posts   
 
    
MagDev
User
Posts: 2
Joined: 20-Jan-2021
# Posted on: 20-Jan-2021 22:33:12   

Hello,

I'm attempting to build a new project using Blazor Server and an older version of LLBLGEN, v4.1 (Self Servicing)

I'm running into an error when attempting to pull data, I have the LLBLGEN setup generally the same way as in an older project.

The error is: System.TypeInitializationException: The type initializer for 'SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine' threw an exception. ---> SD.LLBLGen.Pro.ORMSupportClasses.ORMGeneralOperationException: DbProviderFactory information for compatibilitylevel SqlServer2005 wasn't properly initialized. at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.ObtainDbProviderFactoryInfo(SqlServerCompatibilityLevel compatibilityLevel) at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.SetDefaultDbProviderFactoryParameterData(SqlServerCompatibilityLevel compatibilityLevel) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.set_DefaultCompatibilityLevel(SqlServerCompatibilityLevel value) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine..cctor()

My project is using DI to Inject an 'LLBLGENService' into each component, the connection string is set in the constructor of this service and the Singleton is added in Startup.cs:

public LlblgenService()
{
      CommonDaoBase.ActualConnectionString = Configuration.GetConnectionString("TST");
}

Connection string is a value in my appsettings.json file:

  "ConnectionStrings": {
    "TST": "Data Source=IP;Password=PASS;User ID=USER;Initial Catalog=DATABASE"
  }

Is it possible to get an older version of LLBLGEN working with Blazor in this manner?

Thank you

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 21-Jan-2021 09:38:06   

The compatibility value is usually set either through a config file or through code. What I find odd is that it fails on that particular element as it uses a default. LLBLGen Pro v4.1 is very old so it might be things don't work in this particular setting. The v4.1 runtime is built for netfx, not netcore so chances are that's part of the reason it goes wrong too.

Try setting the compatibility level once, where you set the connection string too:

CommonDaoBase.SetSqlServerCompatibilityLevel( SqlServerCompatibilityLevel.SqlServer2012 );

However as said, this shouldn't be necessary. I suspect the code tries to pull data from a config file which isn't there, as it was written in a time when .net core was something that didn't exist.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39897
Joined: 17-Aug-2003
# Posted on: 21-Jan-2021 14:50:01   

We had another thread with the same issue which was caused by using .net fx builds of the runtimes on .net core so I think this is the same here: llblgen pro v4.1 is build for .net fx (full) only, and can't be used as-is on .net core. To run our runtime on .net core/5 you need the netstandard builds we ship with 5.x

Frans Bouma | Lead developer LLBLGen Pro
MagDev
User
Posts: 2
Joined: 20-Jan-2021
# Posted on: 21-Jan-2021 18:20:58   

Otis wrote:

We had another thread with the same issue which was caused by using .net fx builds of the runtimes on .net core so I think this is the same here: llblgen pro v4.1 is build for .net fx (full) only, and can't be used as-is on .net core. To run our runtime on .net core/5 you need the netstandard builds we ship with 5.x

Hi Otis,

We figured as much, thank you for the confirmation. We will look into upgrading to the latest version.