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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:45:59+00:00 2026-05-30T20:45:59+00:00

When I tried to perform CRUD operations on a POCO against a database, I

  • 0

When I tried to perform CRUD operations on a POCO against a database, I got an exception: NHibernate Mapping Exception: No persister for: MyNamespace.Model.User.

Here is my code:

namespace MyNamespace.Model
{
    public interface IModel<TID>
    {
        TID ID { get; set; }
    }

    public class User : IModel<int>
    {
        public virtual int ID { get; set; }
        public virtual string Name { get; set; }
    }
}

and here is my mapping

namespace MyNamespace.Model.Mapping
{
    public class UserMap : ClassMap<User>
    {
        public UserMap()
        {
            Table("User");
            Id(x => x.ID);
            Map(x => x.Name)
                .Length(255)
                .Unique()
                .Not.Nullable();
        }
    }
}

In my configuration file I have added the assembly mapping:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        ...
        <mapping assembly="MyNamespace" /> 
    </session-factory>
</hibernate-configuration>

I know that such issue occurs if using hbm files, when not set as embedded resources. But in my case I am using Fluent NHibernate where no such files are used. I also read here, that the Mapping classes should be public – I have done that as you can see. All my properties of the model class are virtual (to allow proxies to do their magic). I am absolutely unaware of what I am missing here and I’d be glad to hear any suggestions for this issue.

  • 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-30T20:46:00+00:00Added an answer on May 30, 2026 at 8:46 pm

    The <mapping> element is for hbm resources, not fluent mappings.

    This is straight from the Fluent NHibernate docs:

    private static ISessionFactory CreateSessionFactory()
    {
      return Fluently.Configure()
        .Database(
          SQLiteConfiguration.Standard
            .UsingFile("firstProject.db")
        )
        .Mappings(m =>
          m.FluentMappings.AddFromAssemblyOf<Program>())
        .BuildSessionFactory();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m using Linq to SQl for my project, i tried all CRUD operations
I have tried to perform nested loop in the XSL file but got stuck
I need to perform some action when my application receives focus. I've tried hooking
I tried to perform XSLT transform of a XSD file. My goal is in
I tried for almost an hour to figure out how to perform some validation
I have tried to perform update on table which was trigger by update on
How do I automatically perform unit tests on each build? I tried to add
I'm working on a multithreaded wpf application. To perform globalization i tried to set
I tried to make this code perform faster using Parallel.ForEach and ConcurrentBag but it's
I tried to perform the following in order to update a psuedo-identity value at

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.