ORM Profiler docs

Posts   
 
    
yowl
User
Posts: 266
Joined: 11-Feb-2008
# Posted on: 22-Oct-2021 20:31:44   

I think a small change might be made to the documentation for setting up the profiler (EnablingForProfiling.htm). InterceptorCore.Initialize takes 3 parameters when wrapping the factory, there is a server name string, which is not mentioned in this bit of code:

                  .AddDbProviderFactory(InterceptorCore.Initialize("application name",
                                    typeof(System.Data.SqlClient.SqlClientFactory)))
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Oct-2021 10:21:41   

yowl wrote:

I think a small change might be made to the documentation for setting up the profiler (EnablingForProfiling.htm). InterceptorCore.Initialize takes 3 parameters when wrapping the factory, there is a server name string, which is not mentioned in this bit of code:

                  .AddDbProviderFactory(InterceptorCore.Initialize("application name",
                                    typeof(System.Data.SqlClient.SqlClientFactory)))

Will correct it

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Oct-2021 10:18:28   

There are 2 overloads, 1 takes a server name and one doesn't.

public static Type Initialize(string applicationName, Type factoryTypeToWrap)

which calls

public static Type Initialize(string applicationName, string serverName, Type factoryTypeToWrap)

So the documentation isn't wrong simple_smile We'll leave it as-is.

Frans Bouma | Lead developer LLBLGen Pro
yowl
User
Posts: 266
Joined: 11-Feb-2008
# Posted on: 26-Oct-2021 18:52:35   

Hmm, not in my version from nuget.


    public static bool Initialize(string applicationName) => InterceptorCore.Initialize(applicationName, string.Empty);

    public static bool Initialize(string applicationName, string serverName)
    {
      bool flag = true;
      string appSetting = ConfigurationManager.AppSettings[ApplicationConstants.OrmProfilerEnableConfigSettingName];
      if (appSetting != null)
      {
        try
        {
          flag = XmlConvert.ToBoolean(appSetting);
        }
        catch
        {
        }
      }
      if (flag)
      {
        string str = string.IsNullOrEmpty(applicationName) ? AppDomain.CurrentDomain.FriendlyName : applicationName;
        InterceptorCore.OverwriteDbProviderFactories();
        InterceptorCore.ApplicationName = str;
        InterceptorCore.ApplicationInstanceId = Guid.NewGuid();
        string pipeName = ApplicationConstants.NamedPipeName;
        if (!string.IsNullOrEmpty(serverName))
          pipeName = string.Format("\\{0}\\{1}", (object) serverName, (object) pipeName);
        MessageDispatcher.RegisterNamedPipeChannel(pipeName);
      }
      return flag;
    }

    public static Type Initialize(
      string applicationName,
      string serverName,
      Type factoryTypeToWrap)
    {
      ArgumentVerifier.CantBeNull((object) factoryTypeToWrap, nameof (factoryTypeToWrap));
      string str = string.IsNullOrEmpty(applicationName) ? AppDomain.CurrentDomain.FriendlyName : applicationName;
      Type type = typeof (ProfilerDbProviderFactory<>).MakeGenericType(factoryTypeToWrap);
      InterceptorCore.ApplicationName = str;
      InterceptorCore.ApplicationInstanceId = Guid.NewGuid();
      string pipeName = ApplicationConstants.NamedPipeName;
      if (!string.IsNullOrEmpty(serverName))
        pipeName = string.Format("\\{0}\\{1}", (object) serverName, (object) pipeName);
      MessageDispatcher.RegisterNamedPipeChannel(pipeName);
      return type;
    }
yowl
User
Posts: 266
Joined: 11-Feb-2008
# Posted on: 26-Oct-2021 18:54:19   

SD.Tools.OrmProfiler.Interceptor.NetFull.2.0.3\lib\net452

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Oct-2021 08:40:41   

Yes, that's right, but we have two interceptors: one for .NET Framework (the one you're using) and one for .NET Standard / Core (the one referred at in the docs) simple_smile It's in the section '.NET Core 2.0+', hence we use that interceptor's variant. On .NET Framework it uses the DbProviderFactories table, not a passed in type.

Frans Bouma | Lead developer LLBLGen Pro
yowl
User
Posts: 266
Joined: 11-Feb-2008
# Posted on: 27-Oct-2021 13:52:42   

Ok, guess I was confused by the statement " In that situation you have to use the way it's setup as described below in the #.NET Core 2.0+ section. "

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 28-Oct-2021 09:18:18   

yowl wrote:

Ok, guess I was confused by the statement " In that situation you have to use the way it's setup as described below in the #.NET Core 2.0+ section. "

Will check if that can be formulated better, thanks for the heads up!

(edit) Could you link me to the page where that's located? I can't find it on the page: https://www.llblgen.com/Documentation/ORMProfiler/2.0/Getting%20Started/EnablingForProfiling.htm

Frans Bouma | Lead developer LLBLGen Pro
yowl
User
Posts: 266
Joined: 11-Feb-2008
# Posted on: 28-Oct-2021 13:45:52   

Ah yes, this is the documentation that comes with the install. file:///C:/Program%20Files%20(x86)/Solutions%20Design/ORM%20Profiler%20v2.0/Documentation/Getting%20Started/EnablingForProfiling.htm

In the Note box about half way down starting "If you're using LLBLGen Pro on .NET Full and you're using the RuntimeConfiguration" This is my situation.

Thanks.

BTW : You have some really nice looking stuff on twitter for game photos, not that I know anything about it, but looks really nice.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 28-Oct-2021 13:58:58   

yowl wrote:

Ah yes, this is the documentation that comes with the install. file:///C:/Program%20Files%20(x86)/Solutions%20Design/ORM%20Profiler%20v2.0/Documentation/Getting%20Started/EnablingForProfiling.htm

In the Note box about half way down starting "If you're using LLBLGen Pro on .NET Full and you're using the RuntimeConfiguration" This is my situation. Thanks.

Good catch! The docs online seem to be older than the ones shipped with the installer. We'll update that and correct the text simple_smile

(edit) It is now online. https://www.llblgen.com/Documentation/ORMProfiler/2.0/Getting%20Started/EnablingForProfiling.htm

BTW : You have some really nice looking stuff on twitter for game photos, not that I know anything about it, but looks really nice.

Thanks! Yes it's a hobby of mine to be a photographer in game worlds and I built my own camera tools for that too (which has started to become more than a hobby wink ) More can be found at https://fransbouma.com simple_smile

Frans Bouma | Lead developer LLBLGen Pro