Implementation for cascade all-delete-orphan for Has-one mapping #379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.