Re: Using Reflection to Dynamically Determine Stored Procedure Name

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thank you both for your reply. It is good to know that Reflection
won't help me. Reflector is very useful, but I don't think it will
work for the problem I am trying to solve.

The problem is that my boss, who is a DBA and not a programmer, wants
to know what stored procedures are being called by each aspx page. If
no developer is available to troubleshoot an issue with an aspx page,
he would like to know what procs the page is calling so he might be
able to troubleshoot the problem from the database side. I have access
to the source code and can easily search through it to get a list of
procs that are used by each of the three assemblies that are being
used in this application. The data layer is in a separate assembly
from the website and, to make things more interesting, the website
itself is not in single assembly.

I think I will need to look at this problem from another angle, or
possibly go the ildasm route, if possible.

Tod Birdsall
http://tod1d.net

On Jun 6, 8:50 pm, "Tom Dacon" <tda...@xxxxxxxxxxxxxxxx> wrote:
If you have access to the source code, there's no reason that you couldn't
just do a file system search. If that's true, I don't see the need to get
more elaborate. I've done the same thing for a body of source code that
amounts to several hundred thousands of lines of code, and it was no big
deal.

Tom Dacon
Dacon Software Consulting

"Tod Birdsall" <tbirds...@xxxxxxxxx> wrote in message

news:963d26f3-17a6-4f8a-9c18-1f0c4e61d1e8@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi,

My boss has asked me to create a tool that can give us a list of
stored procedure names that are being called from each of our app's
web pages. This is an ASP.NET application that is rather large and
about 5 years old. I am not here to debate the logic of the request.

The structure of most the application is pretty standardized: We
created a business/data layer that contains methods that have the
names of the stored procedures to call as hard coded strings. The
stored procedures all begin with "USP_", so should be pretty easy to
ferret out.

My initial thought was to use reflection to start at the ASP.NET
assembly, then work my way down to the business/data layer assembly.
So the end report would tell you each namespace.class.method that
leads up to the proc and look something like:

-CompanyApp.Defaultl.aspx.cs.PageLoad()
--BizLayer.GetCustomerData()
---DataLayer.GetCustome()
----"USP_Customer_Get"

Has anyone tried to do anything like this before? Does anyone have any
suggestions on where to begin or can you point me to a tutorial on
something similar?

Thanks for any help you can provide.

Tod Birdsall
http://tod1d.net

.



Relevant Pages

  • Using Reflection to Dynamically Determine Stored Procedure Name
    ... My boss has asked me to create a tool that can give us a list of ... names of the stored procedures to call as hard coded strings. ... My initial thought was to use reflection to start at the ASP.NET ... then work my way down to the business/data layer assembly. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Reflection - Need advice
    ... I used reflection recently when I had to send a text-based command to objects implementing ISignalTarget. ... As a consequence you are able to read those contents yourself, and also execute methods etc too. ... If you have assemblies in a "Plugins" folder of your app that you want loaded dynamically, maybe because other people are allowed to write their own. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: reposted: accessing private members through reflection in vstu
    ... "If the requested property is non-public and the caller does not have ReflectionPermission to reflect non-public objects outside the current assembly, this method returns a null reference." ... You don't actually control reflection permission as narrowly as that. ... You cannot grant specific permission for reflection on specific assemblies to specific assemblies -- you give the assembly permission to perform reflection based on grant sets. ...
    (microsoft.public.dotnet.framework)
  • Re: Number of classes in the .NET Framework
    ... // the reference, and when running in an aspx page, will require a fully ... The only problem I'm seeing with reflection ... >> assemblies, and used reflection to count up the classes and methods. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Using "custom attributes"
    ... do you know reflection well? ... and assemblies ... Attributes only make sense in conjunction with one or more features. ... 2)AspectDNG AOP Framework ...
    (microsoft.public.dotnet.framework.aspnet)