EntityFramework.Extended icon indicating copy to clipboard operation
EntityFramework.Extended copied to clipboard

add feature: INSERT INTO... SELECT ...

Open atmulyana opened this issue 8 years ago • 0 comments

  • Added the feature to execute INSERT INTO... SELECT .... Different from another proposal, it uses more comfortable syntax (in my opinion), that is dbContext.DbSet.Insert(IQueryable).
  • Can execute bulk insert (a lot of rows) into a table by utilizing SqlBulkCopy class. It must be much faster than executing DbSet.AddRange method (or repetitive DbSet.Add method) and then executing dbContext.SaveChanges method. The syntax is dbContext.DbSet.Insert(IEnumerable<Entity>)
  • Moved some repetitive codes in batch runner to QueryHelper
  • Added two members to IBatchRunner interface:
  1. Quote method is to quote an identifier. The implementation for SQL server, the identifier will be enclosed by square bracket ([]), in MySQL will be by backtick (`), in Oracle should be by double quote (").
  2. DbNull property returns null value for db command parameter. In SQL server, it returns DBNull.Value and in MySQL it return null. This property is to avoid repetitive code when copying parameter from ObjectQuery to DbCommand

atmulyana avatar Apr 14 '16 15:04 atmulyana