Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:26:15+00:00 2026-06-01T00:26:15+00:00

Having tried several solutions to get NHibernate to delete orphan records. Given the following

  • 0

Having tried several solutions to get NHibernate to delete orphan records.
Given the following structure:

public class Parent {

    public virtual ICollection<Domain> Domains {get;set;}

}
public class Domain{

    public virtual Parent Parent {get;set;}
}

UPDATE:
It had nothing to do with the setter. This caused something else to go wrong which was fixed. But the deletion of orphans still does not happen
I have tried the following:

  • Add an attribute on Domains (and on the Parent property of the Domain class) according to http://mookid.dk/oncode/archives/643

  • Added Automapping like:

    AutoMap.Override<Parent>(map => { map.HasMany(x => x.Domains).Inverse().Cascade.All(); })
    AutoMap.Override<Parent>(map => { map.HasMany(x => x.Domains).Cascade.All(); })
    

Both caused the Domain records to be stored with Parent_Id = null.

Is there any good example on how to achieve this in combination with Automapping?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:26:16+00:00Added an answer on June 1, 2026 at 12:26 am

    you do not have specified deleteOrphan

    map.HasMany(x => x.Domains).Inverse().Cascade.AllDeleteOrphan()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried several solutions found on other posts but still having problems to autoresize
Ive tried several solutions Ive found on the internet on how to send multipleimages
Having tried this query a million different ways, I can't seem to SELECT 'count_lonely_vehicles'
i have to show 3 columns in List view. I tried having table inside
I'm still entangled in error handling problems. After having read and tried lots of
Having an issue here that I have tried everything I can think of but
I tried endlessly now you resolve this utter frustrating situation I have been having.
I tried to install the Yahoo BOSS mashup framework, but am having trouble running
Having decided to try AForge for video and imaging stuff, I tried to implement
hello i am having same issue, i tried your solution but it didnt help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.