By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

replacing system.data

P: n/a
Hi,
I would like to add some code to system.data so I can trace calls to
SqlConnection class. I used ildasm.exe, got the il code, added some of
mine and used the ilasm.exe to get a new assembly.

The problem is that I cannot remove the old file using the gacutil.exe
.... it says that it is required by other applications ...

How is it possible to remove system.data.dll from the gac or get my
task done in a different way?

Thanks,
Gilad.

Nov 26 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
System.Data is core part of MS..NET Framework, you really cannot remove it
with removing whole .NET framework. The question is, why do yuo want to
remove it? Are you saying that you develop your own ".NET framework" and you
want to replace MS .NET framework with yours? Probably not. If you developed
something, which is based on System.Data/MS .NET framework (that is most
..NET development do), you do not throw those your product based on away, you
nedd them in order for your product to work. If your product is developed
correctly and ready to be placed into GAC, just place it in, and have your
other .NET projects to use it, rather than directly using System.Data (if
your stuff is indeed a replacement of System.Data, but I really doudt it,
sorry.).
"gilad" <gi****@yahoo.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
Hi,
I would like to add some code to system.data so I can trace calls to
SqlConnection class. I used ildasm.exe, got the il code, added some of
mine and used the ilasm.exe to get a new assembly.

The problem is that I cannot remove the old file using the gacutil.exe
... it says that it is required by other applications ...

How is it possible to remove system.data.dll from the gac or get my
task done in a different way?

Thanks,
Gilad.

Nov 26 '06 #2

P: n/a
Hi Gilad,

It's a bad idea to replace System.Data.

Instead, create a class that wraps SqlConnection and trace the calls in
that. You'll have to use your wrapper class instead of SqlConnection
throughout your application:

public class TracedSqlConnection : DbConnection
{
private readonly SqlConnection connection;
private readonly string id;

public TracedSqlConnection(string id, string connectionString)
{
this.id = id;
this.connection = new SqlConnection(connectionString);
}

public override void Open()
{
System.Diagnostics.Trace.WriteLine("Calling Open()",
"TracedSqlConnection: " + id);

connection.Open();

System.Diagnostics.Trace.WriteLine("Open() called",
"TracedSqlConnection: " + id);
}

// TODO: remaining method implementations here
}

--
Dave Sexton

"gilad" <gi****@yahoo.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
Hi,
I would like to add some code to system.data so I can trace calls to
SqlConnection class. I used ildasm.exe, got the il code, added some of
mine and used the ilasm.exe to get a new assembly.

The problem is that I cannot remove the old file using the gacutil.exe
... it says that it is required by other applications ...

How is it possible to remove system.data.dll from the gac or get my
task done in a different way?

Thanks,
Gilad.

Nov 27 '06 #3

P: n/a
thanks all. I'm actually looking for a general way to know which msil
are about to run, which classes, methods and in runtime update the code
so I can get notifications for start/end of methods I'm interested in.

When using third party, it is possible to use ildasm to get the il.
then update it and use ilasm to generate a new assembly. But when it is
system files ... like system.data it is a problem. I read about
profiling api but it has too much overhead and there can only be one
instance running.

Gilad.

Nov 27 '06 #4

P: n/a
Hi Gilad,

Out of curiousity, why do you want this functionality?

--
Dave Sexton

"gilad" <gi****@yahoo.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
thanks all. I'm actually looking for a general way to know which msil
are about to run, which classes, methods and in runtime update the code
so I can get notifications for start/end of methods I'm interested in.

When using third party, it is possible to use ildasm to get the il.
then update it and use ilasm to generate a new assembly. But when it is
system files ... like system.data it is a problem. I read about
profiling api but it has too much overhead and there can only be one
instance running.

Gilad.

Nov 27 '06 #5

P: n/a
I want to be able to give reports on some db products that we use - how
many connections they are using, time in db etc ... stuff to help
figure out some problems. To do this, I need to hijack some of the Sql
classes in the system.data.

I'm surprised there is not enough data on this issue. I'm sure I'm not
the first or the last that want to do this.

Gilad.

Nov 27 '06 #6

P: n/a
What's wrong with the Management tools that perfmon gives you for doing
this?

"gilad" <gi****@yahoo.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
>I want to be able to give reports on some db products that we use - how
many connections they are using, time in db etc ... stuff to help
figure out some problems. To do this, I need to hijack some of the Sql
classes in the system.data.

I'm surprised there is not enough data on this issue. I'm sure I'm not
the first or the last that want to do this.

Gilad.

Nov 27 '06 #7

P: n/a
Hi Gilad,

I agree with Paul's suggestion. There are performance counters for managed
and unmanaged code that can be viewed using the Performance Console utility
(perfmon) or directly in managed code using the PerformanceCounter class in
System.Diagnostics.

"PerformanceCounter Class"
http://msdn2.microsoft.com/en-us/lib...cecounter.aspx

"Runtime Profiling" (perfmon)
http://msdn2.microsoft.com/en-gb/lib...47(VS.80).aspx

Also, the RDBMS that you use will most likely provide proprietary tools for
viewing connectivity, information about transactions and other uses of the
system. Sql Server 2000 and Sql Server 2005 both supply administrative
tools for doing exactly that. One of the more useful tools, which is
separate from Enterprise Manager and the Sql Server Management Studio, is
the Sql Server Profiler.

"Using SQL Server Profiler"
http://msdn2.microsoft.com/en-us/library/ms187929.aspx

--
Dave Sexton

"gilad" <gi****@yahoo.comwrote in message
news:11*********************@h54g2000cwb.googlegro ups.com...
>I want to be able to give reports on some db products that we use - how
many connections they are using, time in db etc ... stuff to help
figure out some problems. To do this, I need to hijack some of the Sql
classes in the system.data.

I'm surprised there is not enough data on this issue. I'm sure I'm not
the first or the last that want to do this.

Gilad.

Nov 27 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.