V2 Beta; Windows Form Application; DotNet standard

Posts   
 
    
arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 11-Dec-2018 22:19:06   

I'm trying to try out the new OrmProfiler V2 beta. My app is windows forms, full frame work using a Llblgen v5.5 data library compiled for dotnet standard.

The profiler client is running on the same machine as the app.

If I reference SD.Tools.OrmProfiler.Interceptor.NetFull.dll

and do


InterceptorCore.Initialize("thumper");
            // Configure the DQE
            RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(
                c =>
                {
                    c.SetTraceLevel(TraceLevel.Verbose)
                        .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))
                        .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012)
                        .AddCatalogNameOverwrite("Thumper_d1", "");
                });

I don't get compile errors, but see nothing in the profiler windows.

if instead I try to treat it as a core application I'm not able to reference SD.Tools.OrmProfiler.Interceptor.NetCore.dll (of course).

With SD.Tools.OrmProfiler.Interceptor.NetFull.dll referenced though I can't compile this.


RuntimeConfiguration.ConfigureDQE<SQLServerDQEConfiguration>(
            c => c.SetTraceLevel(TraceLevel.Verbose)
                  .AddDbProviderFactory(InterceptorCore.Initialize("Thumper",
                                    typeof(System.Data.SqlClient.SqlClientFactory)))
                  .SetDefaultCompatibilityLevel(SqlServerCompatibilityLevel.SqlServer2012));

Am I doing something wrong, is this not supported, does there need to be a different interceptor?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Dec-2018 07:08:03   

arschr wrote:

I don't get compile errors, but see nothing in the profiler windows.

  • Where are you initializing the interceptor (i.e: FormLoad, etc.)

arschr wrote:

With SD.Tools.OrmProfiler.Interceptor.NetFull.dll referenced though I can't compile this.

What is that you can't compile? What is the error?

arschr wrote:

Am I doing something wrong, is this not supported, does there need to be a different interceptor?

What is the code that you are running that didn't get reflected in ORMProfiler window? Did you start the profiling en ORMProfiler?

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 12-Dec-2018 09:33:00   

The one with NetFull is indeed something you can't do: you have to use the normal automatic factory usage and don't need to register the factory manually, as it will obtain it from the DbProviderFactories table (it will wrap all factories there).

the manual wrapping of the factory is needed for .NET Core 2 only, as on .NET Core 2 there's no pre-defined DbProviderFactories table, you have to register the factory first manually anyway, so wrapping it using the interceptor is the easiest. The method InterceptorCore.Initialize(name, type) is only present in the .NET Core variant of the interceptor. So referencing .NETFull and then calling that method will lead to compile errors. You have to reference the .NET Core variant of the interceptor there. You mention you can't reference that one, could you elaborate why?

Registering the factory in RuntimeConfiguration using a .NET Full application and using the .NET Full version of the interceptor won't work indeed, as the llblgen pro runtime won't read the factory from the DbProviderFactories class as it already got the type it needs through the RuntimeConfiguration.

This is indeed something we could add to the .NET Full variant. We don't want to make it a single package with 2 dlls as the API is different and behavior is different: the normal interceptor method isn't available in the .NET Core variant, and that's deliberate (as there's not a central Dbproviderfactories table pre-configured, it has to be pre-filled by your application).

If you use RuntimeConfiguration in a .NET full app btw, you don't need to initialize the DQE with the DbProviderFactory, you can remove that line. If the factory's not present it will obtain it from the central DbProviderFactories table.

Frans Bouma | Lead developer LLBLGen Pro
arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 12-Dec-2018 13:51:01   

You mention you can't reference that one, could you elaborate why? When I select it using nuget and select install, the reference doesn't show up in the project. I haven't looked further.

To make sure I am understanding you. With a dotnet full framework windows form app using dotnet standard to use llblgen framwork 5.5 I should reference the dotnet full interceptor.

If I do this, the app compiles. I don't/can't wrap the factory (as you said).

When I do this the profiler client (running on the same machine) doesn't show any traffic, but the application itself works.

How can I trouble shoot further?

arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 12-Dec-2018 13:56:32   

Where are you initializing the interceptor (i.e: FormLoad, etc.) in the program startup before creating, loading, running the main form.

What is that you can't compile? What is the error? When I try to reference the dotnet core interceptor, nu get doesn't complete the reference. I was trying that interceptor as an experiment since the data layer is dotnet standard.

Referencing the dotnet full interceptor does show the reference and the app compiles and works, but I see nothing in the profiler client.

Did you start the profiling en ORMProfiler? I will retry this morning and make sure I did. If I did and I see no activity in the client, how can I trouble shoot that?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 12-Dec-2018 15:20:38   

arschr wrote:

You mention you can't reference that one, could you elaborate why? When I select it using nuget and select install, the reference doesn't show up in the project. I haven't looked further.

To make sure I am understanding you. With a dotnet full framework windows form app using dotnet standard to use llblgen framwork 5.5 I should reference the dotnet full interceptor.

Yes. (as a winforms app targets .net full, otherwise it won't run)

If I do this, the app compiles. I don't/can't wrap the factory (as you said).

To be clear, you can use RuntimeConfiguration, but you shouldn't use this:


  .AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))

If you do, the DQE has the factory type and won't request one from DbProviderFactories, and therefore won't get a wrapped version (so nothing gets intercepted). If you omit that line, the DQE doesn't have a factory and therefore will obtain one from the DbProviderFactories, which is the wrapped on due to Interceptor.Initialize() and actions will be intercepted.

When I do this the profiler client (running on the same machine) doesn't show any traffic, but the application itself works.

How can I trouble shoot further?

First please make sure the line above is indeed not present in your program. You only have to pass the factory type on .NET core/standard (so the .net standard lib runs on .net core)

Frans Bouma | Lead developer LLBLGen Pro
arschr
User
Posts: 893
Joined: 14-Dec-2003
# Posted on: 12-Dec-2018 16:46:24   

.AddDbProviderFactory(typeof(System.Data.SqlClient.SqlClientFactory))

This line was the problem, I can see traffic in profiler client now.