Using the SqlHelper class with SqlBulkCopy

c# data-access sqlbulkcopy sqlhelper

Question

I've put in placeDataAccessApplicationBlock.msi I obtained theMicrosoft.ApplicationBlocks.Data.dll document to my trash folder. I discovered all except one additional sqlhelper method.ExecuteBulkCopy .

How do I includeExecuteBulkCopy perform to theSqlHelper class?

1
1
11/10/2015 1:36:48 AM

Accepted Answer

That block isn't a abstraction across the database, is it? What would the code do if SQL-Server weren't involved? Encapsulating this in a general-purpose (and database-neutral) library, in my opinion, is not sense.

Additionally, it has rather simple capabilities, so creating a method for the fundamental case that requires a connection-string, database name, andIDataReader / DataTable It includes several configuration choices in non-trivial use (column mapping, events, etc.) and definitely isn't worth encapsulating.

Truth be told, as I useSqlBulkCopy I don't use it often (or similarly) enough to justify keeping it hidden. Maybe simply useSqlBulkCopy directly in your DAL, repository, or other relevant code?

1
1/8/2010 10:00:11 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow