Find Database Dependencies

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I need a way to find all the database dependencies (stored procs, tables,
and views) used by my assemblies. I don't expect to get a perfect solution
since it's possible that stored proc names and ad-hoc queries may be
concatenated from various variables or stored in the config file, but I
would like to be able to isolate +/- 5 lines around where stored proc names
or ad-hoc queries may be used.

Would it be easier to parse the IL instead of the .cs files to find this
information? Any other ideas?

Thanks.
Scott
 
Hi Scott,

Based on my understanding, you want to statically detect an assembly's
database dependency.

Oh, I think this is not a possible way to get this done. For an
application, the database manipulation are some statements, which may be
multiform. Also, what you want to detect is assembly, which has no source
code, so the detection is more hard. How can we determine if some IL code
is database-related?

The only possible way as I think is detecting the database connection at
run-time. You may use DataBase's tool such as Profiler to monitor the
database access run-timely.

I hope my reply makes sense to you.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks Jeffrey, but I'm sure it's possible to find the tables, views, and
stored procedures used in the assembly's files. The only question is how
much effort do I put into the C# and SQL parsers to retrieve the
information. I was hoping someone had a good idea about the best way to
parse out these bits of information.

I'll probably settle for a solution where I list the line numbers with
".Fill", ".ExecuteNonQuery", etc. and let it be a manual process from there.

Any other ideas?

Scott
 
Hi Scott,

Thanks very much for your feedback.

I have already thinked this way of parse source code or IL code for
database related keyword or method or property. But I do not think this
makes sense.

First, the source code may write personal method with the same name of the
database related operation, such as "Fill", "ExecuteReader", you can not
distinguish them.

Also, your project may refer third party library, which may also invoked
the database, so you can not enumerate it.

At last, there are many ways to connect to the database, are you sure you
can enumerate them all? For example, you can use legacy COM interop way to
invoke ADO or ADOX to access the database, which you may not aware of, so
you missed it.

So I think, the only make sense way is using Profiler tool.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Scott,

Does my reply make sense to you? Do you still have any concern on this
issue?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top