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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:25:26+00:00 2026-05-23T17:25:26+00:00

I’m trying to use the persistence specification testing built into FNH. The CheckList method

  • 0

I’m trying to use the persistence specification testing built into FNH. The CheckList method seems to have been added recently, but the older CheckEnumerable has already been deprecated, so I’m assuming that CheckList is stable.

My test code looks similar to this:

new PersistenceSpecification<Parent>(session)
    .CheckProperty(x => x.Foo, 123)
    .CheckList(x => x.Children,
        new Child[] { new Child { Name = "Bob" } },
        (p, c) =>
        {
            p.Children.Add(c);
            c.Parent = p;
        })
    .VerifyTheMappings();

Note that in the mapping, the Parent owns the relationship (has Cascade.AllDeleteOrphan() and doesn’t have Inverse).

When I run it, I get the dreaded “Cannot insert NULL value into…” SQL Server error message, because NHibernate isn’t setting the ParentId on the Child entity. Same as what happens when you forget to set up the association on both ends.

I checked with a breakpoint and the code inside the lambda isn’t even getting executed, which is obviously why the association isn’t being set properly.

The mappings themselves are totally correct; I can write ordinary code to create and insert an entity just fine. It’s just the CheckList method that I can’t get to work.

What am I doing wrong?

  • 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-05-23T17:25:26+00:00Added an answer on May 23, 2026 at 5:25 pm

    I’m not sure why, but it appears that you do need to use CheckComponentList instead of CheckList. I’m not sure what CheckList does or if it works at all right now, but I looked at the SQL trace and CheckComponentList was generating the correct statements.

    CheckComponentList uses the default equality comparer unless one is explicitly specified, which is reference-equality for reference types that do not override Equals, so it is critical to either override Equals in the child entity class or use one of the CheckComponentList overloads that takes an IEqualityComparer argument.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and

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.