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 9162945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:20:03+00:00 2026-06-17T14:20:03+00:00

I’m presently working with a NHibernate application that contains table A that once had

  • 0

I’m presently working with a NHibernate application that contains table A that once had a foreign key reference to another related table B. This constraint has since been purposely removed as items in B may be deleted out of my control by a secondary application.

Though the constraint is now gone the reference from A to B can still be considered useful if the row in B still exists, otherwise it may be treated a null.

If a row is deleted from B that is referenced by A, quite rightly, an exception is thrown stating that “No row with the given identifier exists”.

Is there a way to fluently (or otherwise avoiding explicit queries/joins) to have the object reference return null by the application in the case of a reference from A no longer existing in B, but returning the object as described by B if the reference is valid?

The current unidirectional fluent mapping (treated as a foreign key reference) is rather straight forward looking like

...
References(a => a.b_ref, "b_id");
...
  • 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-17T14:20:05+00:00Added an answer on June 17, 2026 at 2:20 pm

    The reference can be ignored and treated as null when not found by updating the fluent mapping to look like

    ...
    References(a => a.b_ref, "b_id").NotFound.Ignore();
    ...
    

    Sometimes it’s just a matter of stumbling into the right keyword via Google.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Presently I'm working on a Windows Phone application that will work in both online
I'm presently working on a side-by-side application (C#, WinForms) that injects messages into an
Presently, the application in which I am working has got many work flows that
We are working on a web application that is distributed across 3 load-balanced web
Presently I am working on an application which sends and receives file from remote
I am working on an Android application that is required to connect to a
I'm presently working on a large intranet mashup that uses sharepoint to aggregate content
presently i am working on a search application using solrcloud. I have tested many
I am presently working on an application with 3.5 framework. Would it be better
This is a somewhat unusual problem. I'm presently working on an effort to automate

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.