P
Philipp Brune
Hello Newsgroup,
what I want to achieve is to build my own set of
DbCommand/DbConnection/DbDataAdapter/etc. classes
that wrap a given .NET Data Provider like
MySql, Firebird, SqlClient, OleDbClient, etc
and provide the following functionalities on top :
- @ as parameter identifier for parameters in every CommandText
- Ordering of parameters by their occurence in the
CommandText ( I noticed, OleDbClient does not take
the parameter names but uses the order they were appended)
- mapping of BCL types to DbTypes in the parameter (Set BCL type sets
corresponding DbType)
- Refetching identity values from the Db after insert through
DbDataAdapter.
- Fixing schema after reading through DbDataAdapter. For example in
our scenario every column in a Firebird db, which has a generator
assigned must be an AutoIncrement Column in the DataTable. The
Firebird.NET Provider does not see this.
- No SQL Processing, correct SQL for Provider will be generated by a
higher layer.
- Own DbProviderFactory implementation for this.
The first three goals can be easily achieved by deriving from the Db***
classes and redirecting calls to an instance of the underlying provider
with doing the given steps first. Probably someone knows a more elegant
way of doing so, huh ?!
The problem is the DbDataAdapter. I cannot see how to derive my own
DbDataAdapter and easily redirect calls to an underlying SqlDataAdapter
or DbDataAdapter of any other kind since some important methods are
inaccessible due to protection level. Externally registering to the
events of the DbDataAdapter is not suitable, because there is no way
to get notified when the adapter fetched a schema, so i cannot apply
my own schema modifications automagically. Directly implementing the
IDbDataAdapter interface is not a bet too, because my DbProviderFactory
must return a DbDataAdapter not an IDbDataAdapter ( why is this so ? ).
So, any expert, how can i
A ) Modify a DataTable´s schema after it has been fetched from the Db
B ) Postprocess inserting of rows.
with a DbDataAdapter and without any additional Method calls for the
client ? Any clues ?
Thanks a lot in advance
Philipp
what I want to achieve is to build my own set of
DbCommand/DbConnection/DbDataAdapter/etc. classes
that wrap a given .NET Data Provider like
MySql, Firebird, SqlClient, OleDbClient, etc
and provide the following functionalities on top :
- @ as parameter identifier for parameters in every CommandText
- Ordering of parameters by their occurence in the
CommandText ( I noticed, OleDbClient does not take
the parameter names but uses the order they were appended)
- mapping of BCL types to DbTypes in the parameter (Set BCL type sets
corresponding DbType)
- Refetching identity values from the Db after insert through
DbDataAdapter.
- Fixing schema after reading through DbDataAdapter. For example in
our scenario every column in a Firebird db, which has a generator
assigned must be an AutoIncrement Column in the DataTable. The
Firebird.NET Provider does not see this.
- No SQL Processing, correct SQL for Provider will be generated by a
higher layer.
- Own DbProviderFactory implementation for this.
The first three goals can be easily achieved by deriving from the Db***
classes and redirecting calls to an instance of the underlying provider
with doing the given steps first. Probably someone knows a more elegant
way of doing so, huh ?!
The problem is the DbDataAdapter. I cannot see how to derive my own
DbDataAdapter and easily redirect calls to an underlying SqlDataAdapter
or DbDataAdapter of any other kind since some important methods are
inaccessible due to protection level. Externally registering to the
events of the DbDataAdapter is not suitable, because there is no way
to get notified when the adapter fetched a schema, so i cannot apply
my own schema modifications automagically. Directly implementing the
IDbDataAdapter interface is not a bet too, because my DbProviderFactory
must return a DbDataAdapter not an IDbDataAdapter ( why is this so ? ).
So, any expert, how can i
A ) Modify a DataTable´s schema after it has been fetched from the Db
B ) Postprocess inserting of rows.
with a DbDataAdapter and without any additional Method calls for the
client ? Any clues ?
Thanks a lot in advance
Philipp