TWrappedFactory

Posts   
 
    
OlafB
User
Posts: 7
Joined: 07-Jul-2022
# Posted on: 02-Aug-2022 11:17:43   

We've updated our codebase from .NET Framework to .NET6 and subsequently updated "SD.Tools.OrmProfiler.Interceptor" to "SD.Tools.OrmProfiler.Interceptor.NetCore"

We now get an error at the Interceptor.Initialize() method:

'SD.Tools.OrmProfiler.Interceptor.ProfilerDbProviderFactory`1[TWrappedFactory]' violates the constraint of type 'TWrappedFactory'

What's the problem here and how can we resolve it?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 02-Aug-2022 11:42:52   

It might help if you actually posted the code you are using with initializing the factory simple_smile Be aware you have to pass the type e.g.

var wrappedType = InterceptorCore.Initialize("application name", 
                                              typeof(System.Data.SqlClient.SqlClientFactory));

as documented: https://www.llblgen.com/Documentation/ORMProfiler/2.0/Getting%20Started/EnablingForProfiling.htm#net-core-2.0 so you have to pass the type of the DbProviderFactory deriving type of your ADO.NET provider.

Frans Bouma | Lead developer LLBLGen Pro
OlafB
User
Posts: 7
Joined: 07-Jul-2022
# Posted on: 02-Aug-2022 12:16:54   

Thanks for helping out.

We had:

            InterceptorCore.Initialize("IPlan BL", this.GetType());     

and I changed it to:

            InterceptorCore.Initialize("IPlan BL", typeof(Oracle.ManagedDataAccess.Client.OracleClientFactory));        

This seems to solve the problem.