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

Fix for: Issue 238 - Bug: Batch Update with Inheritance #245

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

Conversation

novamxd
Copy link

@novamxd novamxd commented Oct 2, 2017

All the changes I did. Hopefully I did this pull request/forking right... I've never played with this part of Git Hub before.

*Added*
Added support for TPT, TPC, and TPH BatchDelete and BatchUpdate to EF5, EF6
Added support for TPC and TPH BatchDelete and BatchUpdate to EFCore .NET 4.5.1. EFCore 1.x doesn't support TPT.
Added six unit tests to test for BatchDelete and BatchUpdate Inheritance
Compared tests between EF5 and EF6, added some that were missing.

*Changed*
Updated all nuget packages to the highest revision without changing major revisions. Ex: 1.0.0 -> 1.1.3
Changed NETStandard version to 1.6 (from 1.3)
Disabled signing until PFX file is restored
Some general bug fixes and code clean up to get projects to compile for EF5, EF6, and EFCore

*Removed*
Removed cross platform support from testing libraries. Meaning they have the code they need to under their target platforms and nothing extra.
Removed references to the EFPlus Nuget Packages from the Test projects
*Fixed*
Fixed disappearance of AllowPropertyFilter
@JonathanMagnan
Copy link
Member

Oh damn... 160 file modified ;)

I will look at it this week

Best Regards,

Jonathan

@JonathanMagnan JonathanMagnan self-assigned this Oct 2, 2017
@novamxd
Copy link
Author

novamxd commented Oct 2, 2017

Yea it might have been a bit of an interesting project.

@JonathanMagnan
Copy link
Member

Hello @novamxd ,

I have started to investigate it. I made some quick test and it seems to work very fine.

There is some additional code that I will add since some people will want to use the features like this:

int intRowsAffected2 = tcContext.Inheritance_TPC_Animals.Update(i => new Inheritance_TPC_Dog()
{
	ColumnInt = 1
});

Most context normally doesn't have a DbSet for Inheritance_TPC_Dogs

I will probably have to split the EF5|EF6 code from EF Core as a one point, there is not enough thing similar and it make it very hard to maintain.

Time is currently heavily missing but I hope to be able to complete the integration before the end of the month.

Best Regards,

Jonathan

@novamxd
Copy link
Author

novamxd commented Oct 14, 2017

Hey @JonathanMagnan ,

Ok, so long as you don't remove the ability to delete from the sub classes then that works. Realistically speaking I don't know why someone would use TPC if they're not going to reference the sub-classes, as that's the point. Being a DBA I can say that if they wanted the approach you're speaking of, they're likely to go down the TPH route instead, which is already supported with the update I made.

Also did you want a hand splitting up the EF5/6 and Core libraries? I was pretty tempted to do that as part of this update but figured it would just complicate the update.

Regards

@JonathanMagnan
Copy link
Member

Hello @novamxd ,

You might be very surprised with all kind of context I have viewed so far ;)

A lot of people doesn't reference sub-classes (and some are not even aware they could do it), so that's for sure something that need to be supported.

Thank a lot of your help proposition, I believe for this one, it's better I try to do it by merging some of your work to make sure I understand all the code you added, that will make it easier to support it later.

Best Regards,

Jonathan

@novamxd
Copy link
Author

novamxd commented Oct 14, 2017

Hey @JonathanMagnan ,

Do they reference sub-classes with TPC or TPH? Like I said, using the base class with TPH makes sense and I've seen lots of examples for that. To use that with TPC would seem strange, but again, so long as the batch functions work with the sub-classes, I honestly am indifferent.

As for the update and splitting, I agree that getting familiar with the update is the best approach. But if after you finish the merge you want a hand splitting up the libraries, just let me know.

Regards

@JonathanMagnan
Copy link
Member

To make it short, people do everything in every possible way that you may never think ;)

@ashishakm
Copy link

ashishakm commented Oct 16, 2018

I am using Asp.net mvc and doing operation like e.g.
DbContext.Tasks
.Where(t => t.StatusId == 1)
.Update(t => new Task { StatusId = 2 });

I am using Entityframework.Plus library for audit but update is not working other than this new insertion is working fine. I am overriding savechanges() for audit. please on this

@chrfin
Copy link

chrfin commented May 29, 2019

@JonathanMagnan Is there still progress on this? Having the same problem here...

@JonathanMagnan
Copy link
Member

Should already be fixed in https://entityframework-extensions.net/

DeleteFromQuery and UpdateFromQuery are free (which is the same as Batch Delete and Batch Update here), but be careful, otherwise features are paid.

There is currently no short term plan to make a fix on EF Plus at this moment.

@chrfin
Copy link

chrfin commented May 29, 2019

Thanks, did work :-)

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.

None yet

4 participants