Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat Happens When You Access a Shared Function From an Instance of an Object
    primarykey
    data
    text
    <p>The context of this question is that I am trying to debug performance issues (apart from the obvious ones I already know about and can find).</p> <p>I inherited a code base (VB.NET) for an ASP.NET app. This is an app that was developed way back in .NET 1.1 days, and was the first .NET app for a lot of the developers who worked on it. </p> <p>In this code base is a class called DatabaseUtility that contains several Shared Public methods as well as non-Shared Public Functions and Subs for CRUD operations to the database (SQL Server).</p> <p>It is common in my "BL" that a method creates an instance of the DatabaseUtility which essentially figures out what the connection string should be and opens a connection, as well as giving the developer a handle to the other methods contained within it.</p> <pre><code>Dim utility as New DatabaseUtility() </code></pre> <p>Once I have that, I start to create parameters that I am going to pass to one of the methods in DatabaseUtility (like GetDataSet). There is a Shared method in my DatabaseUtility called CreateParameter which does essentially that. It creates a SqlParameter object so I can add it to a Parameters collection.</p> <p>Now, the code base is littered with a lot of this:</p> <pre><code>utility.CreateParameter(...) </code></pre> <p>However, because CreateParameter is a Shared method, I am not sure what is going on behind the scenes. I know because it is a Shared member that an instance of the DatabaseUtility is not created when I call it like this:</p> <pre><code>DatabaseUtility.CreateParameter(...) </code></pre> <p>However, because I am calling it from an instance (utility), does that change the behavior at all? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload