Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feature: INSERT INTO... SELECT ... #203

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

atmulyana
Copy link

@atmulyana atmulyana commented Apr 14, 2016

  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant