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

  • Home
  • SEARCH
  • 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 7566819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:30:35+00:00 2026-05-30T14:30:35+00:00

I have an existing NHibernate application that was created in .NET 2, it’s a

  • 0

I have an existing NHibernate application that was created in .NET 2, it’s a WinForms app that has a separate DLL compiled for the data classes & all the hbm.xml files.

What I want to do now is show on the form which fields are not nullable, by changing the border to red.

Problem is I can’t seem to find anywhere where I can cycle through the bound fields (that I can do) on the form, and read the not-null=”false” (or true) parameter.

Any thoughts?

I am open to Fluent NHibernate, however this is a VB.NET app, and I am a Fluent Nhibernate noob 🙂

Also open to other ways of doing this, as long as I can make them fit into the app reasonably well 🙂

Thanks!

  • 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-30T14:30:36+00:00Added an answer on May 30, 2026 at 2:30 pm

    You don’t need to read the hbm.XML files directory as the SessionFactory contains MetaData regarding all mapped entities. One way to find all meta data for a entity is as follows;

    After the SessionFactory has been built:-

    var metaData = SessionFactory.GetClassMetadata(typeof(Model.Entities.Client));
    for (int i = 0; i < metaData.PropertyNames.Length -1; i++)
    {
        System.Diagnostics.Debug.Print(metaData.PropertyNames[i]);
        System.Diagnostics.Debug.Print(metaData.PropertyNullability[i].ToString());
    }
    

    In my case I get the following:-

    Name
    False
    Address1
    False
    Address2
    True
    ...
    Postcode
    True
    

    Remember FALSE means NOT-NULL that is the property expects an entry

    Another way is to add DataAnnotations to your model properties.

    [Required(ErrorMessage = "You must supply a postcode")]
    public virtual string Postcode { get; set; }
    

    There are good articles on the internet to show you how to use this in a winforms project.

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

Sidebar

Related Questions

I have an ASP.NET MVC web application that implements a custom membership provider. The
I have a C# .NET 3.5 data access layer that is a plain ADO.NET
I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the
I am implementing NHibernate into an existing web application. However, we have some other
I have just started working on an existing Wicket application that uses Hibernate. I
I have an existing ASP.NET website that I would like to port to Azure
I have a existing parent-child relationship I am trying to map in Fluent Nhibernate:
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I have existing Linux shared object file (shared library) which has been stripped. I
I have existing java code and need to create Design Document based on that.

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.