views:

155

answers:

1

I've installed DataAccessApplicationBlock.msi and I got the Microsoft.ApplicationBlocks.Data.dll file into my bin folder. I found every other sqlhelper methods except ExecuteBulkCopy.

How do I add ExecuteBulkCopy function to the SqlHelper class?

+1  A: 

Isn't that block an abstraction over the database? What would the code do if it wasn't SQL-Server? I personally don't think it makes sense to encapsulate this in a general-purpose (and database-neutral) library.

Also; it is pretty basic functionality, so you shouldn't have any problem writing a method for the basic scenario that accepts a connection-string, table name, and IDataReader / DataTable. In non-trivial usage is has lots of configuration options (column mapping, events, etc), and probably doesn't warrant wrapping.

To be honest, while I use SqlBulkCopy, I don't use it often enough (or similarly enough) to warrant hiding it away. Perhaps just use SqlBulkCopy directly in your repository / DAL / whatever code?

Marc Gravell