Connecting to SQL CE File

Posts   
 
    
AlexS
User
Posts: 14
Joined: 18-Apr-2016
# Posted on: 28-Dec-2021 10:54:01   

Hello! I have LLBLGENPRO 5.8, .net standard 2 for my LLBLGEN-Project and .net 6 for Main-Project. Now i try to open a .sdf Database with SQL CE 4.0 Format. But setting SqlServerCompatibiltyLevel to SqlServerCE40, occurs an exception.

Doing the same with SQL-Server (and of course with CompatibilityLevel SqlServer2012, it works fine! Onliy with CE40 I have problems (and also with CE35...).

My Code:

RuntimeConfiguration.AddConnectionString("Main.ConnectionString", @"Data Source=" + sdfPath);  // = C:\xxxx\
                    
                    RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(
                                c => c.SetTraceLevel(TraceLevel.Verbose)
                                        .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))
                                        .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServerCE40));

Exception: "DbProviderFactory information for compatibilitylevel SqlServerCE40 wasn't properly initialized. Please use the RuntimeConfiguration.ConfigureDQE method to register the SqlClient DbProviderFactory with this DynamicQueryEngine. See the RuntimeConfiguration documentation for examples." RuntimeBuild: 5.8.3_Netstandars2x SerializationStackTraceString " at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.ObtainDbProviderFactoryInfo(SqlServerCompatibilityLevel compatibilityLevel) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.Configure(SQLServerDQEConfiguration configuration)\r\n at SD.LLBLGen.Pro.DQE.SqlServer.SQLServerDQEConfiguration.Configure()\r\n

My included Packages: SD.LLBLGen.Pro.DQE.SqlServer SD.LLBLGen.Pro.ORMSupportClasses

I have also installed Microsoft® SQL Server® Compact 4.0 SP1

I can open my .sdf File with LinqPad 7 (after installing MS SQL Server Compact 4.0 SP1).

Can you give me a hint?

Thank you very much!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 28-Dec-2021 11:40:02   

SQL Server CE databases are only supported on .NET Framework, not on .NET 6 / netstandard, as they depend on a driver (supplied by microsoft, the client for ce) that's windows / .net framework only.

Frans Bouma | Lead developer LLBLGen Pro
AlexS
User
Posts: 14
Joined: 18-Apr-2016
# Posted on: 28-Dec-2021 14:00:27   

Otis wrote:

SQL Server CE databases are only supported on .NET Framework, not on .NET 6 / netstandard, as they depend on a driver (supplied by microsoft, the client for ce) that's windows / .net framework only.

Thank you Otis, for this information! Oh, so i can't switch my App to .net. That's a pity. It is confusing when "SqlServerCompatibilityLevel.SqlServerCE40" is available. I didn't find anything in the documentation about it.

Thanks a lot for your help,

Alex

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 30-Dec-2021 09:05:43   

AlexS wrote:

Otis wrote:

SQL Server CE databases are only supported on .NET Framework, not on .NET 6 / netstandard, as they depend on a driver (supplied by microsoft, the client for ce) that's windows / .net framework only.

Thank you Otis, for this information! Oh, so i can't switch my App to .net. That's a pity. It is confusing when "SqlServerCompatibilityLevel.SqlServerCE40" is available. I didn't find anything in the documentation about it.

Thanks a lot for your help,

Alex

When you generate code for .NET 4.8 for instance, you can use SQL Server CE, but not on .net 6. .NET 6 is the continuation of .NET Core, which isn't a successor of .NET 4.8.

Frans Bouma | Lead developer LLBLGen Pro
AlexS
User
Posts: 14
Joined: 18-Apr-2016
# Posted on: 30-Dec-2021 09:16:32   

Otis wrote:

When you generate code for .NET 4.8 for instance, you can use SQL Server CE, but not on .net 6. .NET 6 is the continuation of .NET Core, which isn't a successor of .NET 4.8.

My .net Framework 4.8 App with LLBLGEN works fine with SQL CE since a lot of years. But as you know, .net Framework 4.8 will not be continued from Microsoft and in 6 years it will be out of service. So i tried to convert my App, just to see how it works. But without SQL CE i have to think for a better solution. Well, i have just 6 years time... wink

All best wishes and stay healthy,

Alex