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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:18:55+00:00 2026-05-14T01:18:55+00:00

I am following the http://wiki.fluentnhibernate.org/Getting_started tutorial to create my first NHibernate project with Fluent

  • 0

I am following the http://wiki.fluentnhibernate.org/Getting_started tutorial to create my first NHibernate project with Fluent NHibernate

I have 2 tables

1) Account with fields

Id
AccountHolderName
AccountTypeId

2) AccountType with fields

Id
AccountTypeName

Right now the account types can be Savings or Current
So the table AccountTypes stores 2 rows
1 – Savings
2 – Current

For AccoutType table I have defined enum

public enum AccountType {
    Savings=1,
    Current=2
}

For Account table I define the entity class

public class Account {
    public virtual int Id {get; private set;}
    public virtual string AccountHolderName {get; set;}
    public virtual string AccountType {get; set;}
}

The fluent nhibernate mappings are:

public AgencyMap() {
    Id(o => o.Id);
    Map(o => o.AccountHolderName);
    Map(o => o.AccountType);
}

When I try to run the solution, it gives an exception – InnerException = {“(XmlDocument)(2,4): XML validation error: The element ‘class’ in namespace ‘urn:nhibernate-mapping-2.2’ has incomplete content. List of possible elements expected: ‘meta, subselect, cache, synchronize, comment, tuplizer, id, composite-id’ in namespace ‘ur…

I guess that is because I have not speciofied any mapping for AccountType.

The questions are:

  1. How can I use AccountType enum
    instead of a AccountType class?
  2. Maybe I am going on wrong track. Is there a better way to do this?

Thanks!

  • 1 1 Answer
  • 4 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-14T01:18:56+00:00Added an answer on May 14, 2026 at 1:18 am

    The following apparently no longer works https://stackoverflow.com/a/503327/189412

    How about just doing this:

    public AgencyMap() {
        Id(o => o.Id);
        Map(o => o.AccountHolderName);
        Map(o => o.AccountType).CustomType<AccountType>();
    }
    

    The custom type handles everything 🙂

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

Sidebar

Related Questions

I'm attempting to create a C kernel initially following this tutorial: http://wiki.osdev.org/Bare_Bones However, my
I am getting the following error: I am following this tutorial: http://wiki.minix3.org/en/DevelopersGuide/DriverProgramming This is
I have the following JSON string (from wikipedia http://en.wikipedia.org/wiki/JSON ) { name:Product, properties: {
I am trying to install the DBPedia extraction framework following the http://wiki.dbpedia.org/Documentation I have
I'm following the tutorial from http://wiki.wxpython.org/Getting%20Started and I'm busy with the notebook example. Here,
I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls |
i'm following this tutorial: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide and downloading my own source of mod_wsgi. The problem
I am following their tutorial here: http://developers.sones.de/wiki/doku.php?id=quickreference:fiveminuteguide But when I copy and paste this
When I try to install redmine by following the procedure here: http://www.redmine.org/projects/redmine/wiki/RedmineInstall At step
I just installed xcache on my server (Fedora 16) following the tutorial on http://xcache.lighttpd.net/wiki/InstallFromSource

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.