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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:57:48+00:00 2026-05-31T05:57:48+00:00

I am using NHibernate in my web application. So far I have created this

  • 0

I am using NHibernate in my web application. So far I have created this following hibernate mapping object class:

namespace Dao {
    /// <summary>
    /// Summary description for User
    /// </summary>
    public class User {
        private int _id;

        public int Id {
            get {
                return _id;
            }

            private set {
                _id = value;
            }
        }

        private string _name;

        public string Name {
            get {
                return _name;
            }

            set {
                _name = value;
            }
        }

        public User() {

        }
    }
}

The following code:

Configuration configuration = new Configuration();
configuration.Configure();
configuration.SetProperty("connection.connection_string", WebConfigurationManager.ConnectionStrings["EMSConnectionString"].ConnectionString);            
HbmSerializer.Default.Validate = true;
configuration.AddInputStream(HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()));            
configuration.AddDirectory(new DirectoryInfo(HttpContext.Current.Server.MapPath("~/App_Code/Dao")));
SessionFactory = configuration.BuildSessionFactory();
SchemaExport se = new SchemaExport(configuration);
se.Drop(false, true);
se.Create(false, true);

from the constructor of the class NHibernateModule : IHttpModule.

This is my hbm.xml

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Dao" assembly="Dao">

<class name="Dao.User" table="User">
  <id name="Id" column="Id">
    <generator class="native"/>
  </id>
  <property name="Name" column="Name" length="50"/>
</class>

Now the class User is in Dao folder of App_Code, the hbm.xml resides in the same Dao folder and the class NHibernateModule is in the HttpModules folder of App_Code:

App_Code
|-------Dao
|          |---User.cs
|          |---NHibernateMapping.hbm.xml
|-------HttpModules
           |---NHibernateModule.cs

When I am running the application I am getting:

[MappingException: The following assembly contains no mapped classes: App_Code.qy81yxpd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]
NHibernate.Mapping.Attributes.HbmSerializer.Serialize(Stream stream, Assembly assembly) +2855
NHibernate.Mapping.Attributes.HbmSerializer.Serialize(Assembly assembly) +132
HttpModules.NHibernateModule..cctor() in e:\EMS\App_Code\HttpModules\NHibernateModule.cs:26

Any information will be very helpful to me.

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-31T05:57:49+00:00Added an answer on May 31, 2026 at 5:57 am

    Have you set your hbm.xml file to be embedded resource?

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

Sidebar

Related Questions

I'm using NHibernate for a web application. I have a model like this: public
We are developing a web application using Spring framework and Hibernate ORM. As far
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
This is a pretty fundamental question when using NHibernate in a web application, but
I have a c# library for my web application where I am using nhibernate.
I have an MVC3 application using NHibernate. I've created my own membership and role
I'm developing a web- application using NHibernate. Can you tell me how to write
What is the best approach to managing NHibernate transaction using Autofac within web application?
I am developing an MVC application using nHibernate; running through VS's built in web

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.