R
Rory Plaire
Greetings all,
I am (was, rather -- I have since went the route of containment to
implement the pattern) trying to inherit DataTable to construct a Lazy
Load patterned table for large result sets.
However, I kept getting an error when adding new rows... exceptions
were thrown declaring the row to have already been added to the
collection, however, if I didn't call DataTable.Rows.Add, the
exception was, of course, that I hadn't added the row to the table...
The structure was simple: override (actually, hide) the Rows property
on the descended table class and return a wrapper to the underlying
DataRowsCollection class of the base table, one which would catch
accesses to rows which were not yet loaded.
The problem came in trying to add new rows through the wrapper... it
seems like it couldn't be done. I tried to disassemble DataTable in
..Net Reflector to see which code was setting the row membership, but
could discern it. I chalked it up to a flaw in the design (since the
base behavior was contradictory), but would love to hear if anyone has
more insight into this matter.
thanks,
-rory 8)
I am (was, rather -- I have since went the route of containment to
implement the pattern) trying to inherit DataTable to construct a Lazy
Load patterned table for large result sets.
However, I kept getting an error when adding new rows... exceptions
were thrown declaring the row to have already been added to the
collection, however, if I didn't call DataTable.Rows.Add, the
exception was, of course, that I hadn't added the row to the table...
The structure was simple: override (actually, hide) the Rows property
on the descended table class and return a wrapper to the underlying
DataRowsCollection class of the base table, one which would catch
accesses to rows which were not yet loaded.
The problem came in trying to add new rows through the wrapper... it
seems like it couldn't be done. I tried to disassemble DataTable in
..Net Reflector to see which code was setting the row membership, but
could discern it. I chalked it up to a flaw in the design (since the
base behavior was contradictory), but would love to hear if anyone has
more insight into this matter.
thanks,
-rory 8)