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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:58:46+00:00 2026-05-11T16:58:46+00:00

I want to implement NHibernate on my domain objects in my project, but I’m

  • 0

I want to implement NHibernate on my domain objects in my project, but I’m not sure how I should go about generating the mapping file, and the database.

I’ve found some questions that kind of touch on this here and here, but I’m starting with my classes already defined, and would like to start from them and work my way down, not the other way around.

Is there any way to do this?

I’m perfectly fine with a multi-stage process, I just want to know what other people have done that was successful for them.

FYI, I want to deploy the database on SQL Server 2005.

  • 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-11T16:58:46+00:00Added an answer on May 11, 2026 at 4:58 pm

    About the mapping:
    You can create the mapping with the Fluent Mapping like Gary.
    When you have a very uncomplicated domain model, you can use Automapping, a convention based mapping feature of FluentNhibernate:

     var sessionFactory = Fluently.Configure()  
       .Database(MsSqlConfiguration.MsSql2005  
         .ConnectionString(c => c  
           .Is(ApplicationConnectionString)))  
       .Mappings(m =>  
         m.AutoMappings.Add(AutoPersistenceModel.MapEntitiesFromAssemblyOf<Product>())  
       )  
       .BuildSessionFactory();
    

    And that’s all you need.

    You can build your database with schemaexport:

    var schemaExport = new SchemaExport(configuration);
    schemaExport.Create(false,true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement lucene based hibernate search in my assignment. For generating domain
I want implement in my software solution an VBA editor but in c# 3.0.
I knew nHibernate does not support UNION. But there are some tricks, we can
I have implement testing app. which uses fluent nhibernate mapping to db object inside
I want to serialize some objects into Json. Sometimes (not always, and I don't
I am trying to implement privileges using NHibernate, and what I want to do,
I'm new to NHibernate and not very good at C#, but I'm learning. I
This is similar to this question: NHibernate - Implement "NOT IN" query using ICriteria
I want to implement a Role Hierarchy but am rather new to JPA Annotations.
I want to implement some universal filter with Hibernate Criteria . It should work

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.