EntityFramework-Plus
EntityFramework-Plus copied to clipboard
Feature Request BatchInsert
Similar to BatchUpdate, with little modification, can you please provide support for BatchInsert for following example.
var emails = db.Emails.AsQueryable();
db.Contacts
.Where( x => x.Active &&
! emails.Any( er => er.EmailAddress == x.EmailAddress ) ) )
.Select( x => new Email{
EmailAddress = x.EmailAddress,
Subject = "Welcome to network !!"
} ).Insert();
It would be very simple as
`INSERT INTO [TableName](Columns...) ... GENERATED SELECT QUERY`
Hello @neurospeech ,
We will investigate this request next week to check if we can easily do it.
Best Regards,
Jonathan
We would love this feature too!
Any update here? I also wanted to add that on website there is an information about free Batch Insert which redirects to InsertFromQuery (from paid extensions). That is probably an error:
Hello @jakoss ,
The InsertFromQuery, UpdateFromQuery, and DeleteFromQuery methods in EF Extensions are FREE. EF Plus has a reference to EF Extensions, so you can already use it as well.
I added a task on my side to make free features as free in their respective documentation.
So, the current issue is already completed.
See an example:
var date = DateTime.Now.AddYears(-2);
context.Customers
.Where(x => x.IsActive && x.LastLogin < date)
.InsertFromQuery("bck_Customer", x => new { x.CustomerID, x.Name, x.Email });
Let me know if you have any additional questions.
Best Regards,
Jon
Hello @JonathanMagnan, thanks for the answer!
I read into the whole EF Plus referencing EF Extensions. It all makes perfect sense, but it's tricky to understand for a newcomer (here's me). I had to put in some time to understand the model here. I think that detailing directly on the docs page what's free and what's paid would be of great help here. Because i found the tables with features, but on docs i cannot find those information
Hello @jakoss ,
That sure is understandable to be a little bit lost in it. I would not either know if InsertFromQuery is indeed free or not with the current state of this page.
That is sure something we will try in the upcoming weeks.