简体   繁体   中英

Mock SqlBulkCopy in c#

Which Interface or abstract class should I use to mock SqlBulkCopy object in c#? I am trying to BCP table from Oracle to SQL Server.

Please let me know if there is an alternate solution.

There is no suitable interface. Create a wrapper class.

Probably the closest is passing a TVP to the SQL Server stored proc using a ADO.Net SqlCommand.

For that, you need to load first all records into DataTable, then pass the DataTable to the SqlCommand.

Check this link http://www.mssqltips.com/sqlservertip/2112/table-value-parameters-in-sql-server-2008-and-net-c/

Another option is calling the BULK INSERT directly from C# http://msdn.microsoft.com/en-us/library/ms188365.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM