interesting solution.
What i get from this is that you gain simplicity by doing away with the
mapping code (you assume the parameters map to the columns) and
ignoring data collisions (handled in the ADO.Net code generated
solution by using the Original_ columns) or handling them differently
- i.e. through use of timestamp column.
Passing a typed data row as a parameter is in effect your Data Adapter,
though it would require multiple calls for each row as opposed to using
SQLDataAdapter which would manage this for you.
Do you match the columns and parameters dynamically at runtime or do
you include in your compiled code?
cheers
Ian
> interesting solution.
>
[quoted text clipped - 3 lines]
> solution by using the Original_ columns) or handling them differently
> - i.e. through use of timestamp column.
Using a column named "RowVersion" of type "Timestamp" :) In our update and
delete stored procedures, there are two parameters, TableId and RowVersion.
If no rows were updated/deleted, that means there was a concurrency
error....
> Passing a typed data row as a parameter is in effect your Data Adapter,
> though it would require multiple calls for each row as opposed to using
> SQLDataAdapter which would manage this for you.
Yes. But we do not do much in the way of updating thousands of lines of
code using .Net. If we needed to do such a thing, we use DTS packages on
SQL Server :) If it's a one-time update of a million records, a quick
console app using SQLDataAdapter does the trick..
> Do you match the columns and parameters dynamically at runtime or do
> you include in your compiled code?
This is handled by the Enterprise Library Data Access Application Block. I
modified the application block to accept a "TypedParams" parameter for most
of their stored procedure methods (ExecuteScalar, ExecuteNonQuery, et
cetera). These overloads then take the columns from the TypedParams row and
maps them to the stored procedure parameters (by name, not ordinal). In
this case, consistancy is key. If we change a parameter name, and the name
of the table column is left alone, this will break. Therefore, shop
standards state that the parameter names must match table column names.
> cheers
u2
> Ian
Mythran