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

Implementation for cascade all-delete-orphan for Has-one mapping #379

Merged
merged 5 commits into from
Sep 18, 2020

Conversation

norrbacka
Copy link
Contributor

Accordingly to Xhafan on https://stackoverflow.com/questions/13864384/fluent-nhibernate-one-to-one-doesnt-have-cascade-all-delete-orphan/44026508#44026508 who wrote:

"_This is now supported in NHibernate 4.1 - one to one relation ship cascade "all-delete-orphan" is now properly supported (issue NH-1262 has been fixes in 4.1). I tested that and can confirm it's working - once you set the child one-to-one property to null, it issues sql delete command for the child.

Unfortunately, fluent nhibernate does not support it, as it has been last updated in 2015. But, you can build fluent nhibernate yourself from the source code (https://github.com/jagregory/fluent-nhibernate, How to build Fluent NHibernate? ; I struggled with this a bit - you need to install ruby, rubygems, run InstallGems.bat, manually run "bundle install" (was not executing for me for some reason), and build the solution using "rake" command).

Then all you have to do is to move method AllDeleteOrphan from CollectionCascadeExpression class to CascadeExpression class and build it (you can also build it using visual studio 2010+ opening FluentNHibernate.sln, but you have to run "rake" command at least once).

enter image description here

Custom built (by me) FluentNHibernate.dll version 2.0.3.1 with HasOne AllDeleteOrphan support can be downloaded from here_"

I've not tested my changes because I am not familiar with ruby and rubygems so I have not tried to build it, yet doing a pull request maybe could encourage someone else to bring this change to existence by reviewing my change, building and test it.. At the very least it can be inspiration for others struggling with the same mapping issue. Xhafan also linked a compiled version with this change, however some may find it a bit risky to just use someone else's dll.

govorovvs added a commit to govorovvs/fluent-nhibernate that referenced this pull request Nov 16, 2017
@kirilvit
Copy link

Any news on this PR? I'm faced with the same issue(

@norrbacka
Copy link
Contributor Author

Sorry Kirilvit, I dont know. Personally, I am not utsikt NHibernate any more.

@hazzik hazzik removed the needTests label Sep 18, 2020
@hazzik hazzik merged commit 2954415 into nhibernate:master Sep 18, 2020
@hazzik hazzik added this to the 2.1.3 milestone Sep 18, 2020
@hazzik hazzik added feature and removed improvement labels Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants