EntityFramework.Extended
EntityFramework.Extended copied to clipboard
add feature: INSERT INTO... SELECT ...
- Added the feature to execute
INSERT INTO... SELECT .... Different from another proposal, it uses more comfortable syntax (in my opinion), that isdbContext.DbSet.Insert(IQueryable). - Can execute bulk insert (a lot of rows) into a table by utilizing
SqlBulkCopyclass. It must be much faster than executingDbSet.AddRangemethod (or repetitiveDbSet.Addmethod) and then executingdbContext.SaveChangesmethod. The syntax isdbContext.DbSet.Insert(IEnumerable<Entity>) - Moved some repetitive codes in batch runner to
QueryHelper - Added two members to
IBatchRunnerinterface:
-
Quotemethod 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 ("). -
DbNullproperty returns null value for db command parameter. In SQL server, it returnsDBNull.Valueand in MySQL it returnnull. This property is to avoid repetitive code when copying parameter fromObjectQuerytoDbCommand