M
mmatchyn
I have been trying to create a class similar to SqlClient but one that
prints sql statements instead of running them on the database. This
way when I want to go into test mode I comment out the SqlClient class
and comment in the test class.
The problem I am facing now is I have to limit myself to simple
functions for the SqlDataReader class. I would like to copy in the
SqlDataReader object exactly the way it is so that I can use this test
code universally on every C# project. The final result would be
calling this sql test class defines SqlDataReader exactly the way it
is in SqlClient, but SqlCommand will be defined differently so that
all sql update/insert/delete commands are printed and never actually
run on the database.
Any ideas on how I might go about this?
Is there a way I can define SqlDataReader within a user defined class
SqlTest and have it extend the SqlDataReader class of SqlClient? Then
I already have my own definition for SqlCommand that works like a
charm for the kind of testing I am doing.
Another possibility can I call SqlClient to get the SqlDataReader
class but then override the SqlCommand class with the functions I
already defined? I need some help with this.
Mark
prints sql statements instead of running them on the database. This
way when I want to go into test mode I comment out the SqlClient class
and comment in the test class.
The problem I am facing now is I have to limit myself to simple
functions for the SqlDataReader class. I would like to copy in the
SqlDataReader object exactly the way it is so that I can use this test
code universally on every C# project. The final result would be
calling this sql test class defines SqlDataReader exactly the way it
is in SqlClient, but SqlCommand will be defined differently so that
all sql update/insert/delete commands are printed and never actually
run on the database.
Any ideas on how I might go about this?
Is there a way I can define SqlDataReader within a user defined class
SqlTest and have it extend the SqlDataReader class of SqlClient? Then
I already have my own definition for SqlCommand that works like a
charm for the kind of testing I am doing.
Another possibility can I call SqlClient to get the SqlDataReader
class but then override the SqlCommand class with the functions I
already defined? I need some help with this.
Mark