G
Gleb Holodov
Dear all!
I don't know if anyone has ever experienced the same problems as I did, but
I would like to suggest a number of changes or at least directions of
re-engineering which, once implemented, will make ADO.NET faster, more
flexible and better than it was at all.
1) it's really annoying that I cannot filter off the rows in a dataset
that I pass to IDbDataAdapter.Update. The most common (but not the only one)
would be to filter by DataRowStatus - like Modified, Deleted, etc.
The standard recommendation is to first call GetChanges and then feed a
data adapter with a "changes-only" dataset: someAdapter.Update(
ds.GetChanges( DataRowStatus.Deleted ) );
Although this way seems to be quite natural, it has a number of
problems:
a) perormance problems beacuse of unnecessary copying: all modified
rows and rows, with at least one of the descendants modified, will be
copied, not just referenced in a derived dataset.
b) loss of accept/reject and error info information: a data adapter
sets this info for rows of a dataset returned from GetChanges, and it's a
real pain-in-the-* to migrate these changes back to an original dataset.
From my perspective, it would be much more natural to have a way to
create some sort of DataSet View, say, DataSet.CreateView( ds,
DataSetFilter.ByStatus( DataRowVersion.Deleted ) ), and feed it to
IDbDataAdapter instead of original DataSet itself.
2) when I write ado.net-provider-idependent code, I cannot (without
having to use emit) bind to RowUpdating/Updated events: they all have
different signatures and so I cannot bind a single pre-written
provider-method to handle these notifications.
The problem is that delegates expect methods with exactly matching
signatures as their parameters. Yes, it's safe, but it's really annoying,
since it doesn't take polymorphism into account. Why can't I write an event
handler zzz(object, object) to handle events of any kind?? I suppose, there
could be some performance and security issues I'm unaware of, which kept
..net developers from allowing this, but again, in the way it's done, it's
VERY unflexible.
3) the framework doesn't allow me to extend it even for a little bit:
although DataSet is inheritable, it greatly limits inheritors. For example,
it would be possible to create DataSetView class as a subclass of a DataSet,
if only DataSet.Tables and DataTable.Rows properties had been virtual. But
they're not. Sob.
4) DataSet can perfectly explain what's wrong with a new row that I'm
trying to insert into its table (like FK, PK or check constraint violation),
but it's ultimately laconic in EnableConstraints() - it doesn't give a clue
on what's wrong.
5) Bad support of complex relationships - there're cases when
DataSet.GetChanges runs into stack overflow if there're circular
relationships (whether direct or indirect).
Thanks,
Gleb
I don't know if anyone has ever experienced the same problems as I did, but
I would like to suggest a number of changes or at least directions of
re-engineering which, once implemented, will make ADO.NET faster, more
flexible and better than it was at all.
1) it's really annoying that I cannot filter off the rows in a dataset
that I pass to IDbDataAdapter.Update. The most common (but not the only one)
would be to filter by DataRowStatus - like Modified, Deleted, etc.
The standard recommendation is to first call GetChanges and then feed a
data adapter with a "changes-only" dataset: someAdapter.Update(
ds.GetChanges( DataRowStatus.Deleted ) );
Although this way seems to be quite natural, it has a number of
problems:
a) perormance problems beacuse of unnecessary copying: all modified
rows and rows, with at least one of the descendants modified, will be
copied, not just referenced in a derived dataset.
b) loss of accept/reject and error info information: a data adapter
sets this info for rows of a dataset returned from GetChanges, and it's a
real pain-in-the-* to migrate these changes back to an original dataset.
From my perspective, it would be much more natural to have a way to
create some sort of DataSet View, say, DataSet.CreateView( ds,
DataSetFilter.ByStatus( DataRowVersion.Deleted ) ), and feed it to
IDbDataAdapter instead of original DataSet itself.
2) when I write ado.net-provider-idependent code, I cannot (without
having to use emit) bind to RowUpdating/Updated events: they all have
different signatures and so I cannot bind a single pre-written
provider-method to handle these notifications.
The problem is that delegates expect methods with exactly matching
signatures as their parameters. Yes, it's safe, but it's really annoying,
since it doesn't take polymorphism into account. Why can't I write an event
handler zzz(object, object) to handle events of any kind?? I suppose, there
could be some performance and security issues I'm unaware of, which kept
..net developers from allowing this, but again, in the way it's done, it's
VERY unflexible.
3) the framework doesn't allow me to extend it even for a little bit:
although DataSet is inheritable, it greatly limits inheritors. For example,
it would be possible to create DataSetView class as a subclass of a DataSet,
if only DataSet.Tables and DataTable.Rows properties had been virtual. But
they're not. Sob.
4) DataSet can perfectly explain what's wrong with a new row that I'm
trying to insert into its table (like FK, PK or check constraint violation),
but it's ultimately laconic in EnableConstraints() - it doesn't give a clue
on what's wrong.
5) Bad support of complex relationships - there're cases when
DataSet.GetChanges runs into stack overflow if there're circular
relationships (whether direct or indirect).
Thanks,
Gleb