Book Image

Learning .NET High-performance Programming

By : Antonio Esposito
Book Image

Learning .NET High-performance Programming

By: Antonio Esposito

Overview of this book

Table of Contents (16 chapters)
Learning .NET High-performance Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

ADO.NET bulk copy


In modern database access programming, the use of an object-oriented approach similar to the one available throughout EF is obvious. Although in most scenarios EF performs very well, there are specific cases when we want to use ADO.NET, for instance, when we want use some specific feature of the data provider or the database itself. Obviously, this choice is available at the cost of sacrificing the simplicity and reliability of dealing with an object-oriented data access layer. Although for custom database features we have to deal with the SQL language, often such features are available as data provider-specific features within ADO.NET classes.

Bulk copy is a great feature offered by the System.Data.SqlClient data provider. It allows the insertion of a lot of data within a database table without having to fulfill all INSERT validations or execution times. This boosts the throughput of the whole operation heavily. Here's an example of bulk copying:

//create a temporary data...