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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:14:39+00:00 2026-05-26T19:14:39+00:00

In a project MyProject.Data, I have a folder named mappings with all mapping in.

  • 0

In a project MyProject.Data, I have a folder named mappings with all mapping in.

namespace MyProject.Data.Mappings {
    public class EmployeeMap : ClassMap<Employee>
    {
        public EmployeeMap()
        {
            Id(x => x.Id);
            Map(x => x.FirstName).Not.Nullable().Length(100);
            Map(x => x.LastName).Not.Nullable().Length(100);
        }
    } }

In the MVC project, in the web.config :

  <connectionStrings>
    <add name="db" connectionString="Data Source=localhost\SQLExpress;Initial Catalog=MyDB;Integrated Security=True"/>
  </connectionStrings>

In the global.asax.cs, I’d like create the ISessionFactory :

var nhConfig = Fluently.Configure().Database(MsSqlConfiguration.MsSql2008
   .ConnectionString(c => c.FromConnectionStringWithKey("db")))
   .Mappings(m => m.FluentMappings.AddFromAssemblyOf<?????>())
   .BuildConfiguration();
ISessionFactory SessionFactory = nhConfig.BuildSessionFactory();

I need a :
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<?????>()) for each mapping file ?

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-26T19:14:39+00:00Added an answer on May 26, 2026 at 7:14 pm

    No, that serves that purpose of telling FNH which assembly to look for all your mappings. Just specify any one and you are good to go.

    So, the code below will work for you if all your mappings live in the same assembly.

    var nhConfig = Fluently.Configure().Database(MsSqlConfiguration.MsSql2008
    .ConnectionString(c => c.FromConnectionStringWithKey("db")))
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<EmployeeMap>())
    .BuildConfiguration();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have file.txt data file in my project which is in resource folder. Now
Currently in my project directory I have a folder called Data and in it
I have a content folder at /Data in my project. When I build it
I have created data sources from my objects in my project, some of which
I am trying to compile my Visual Basic .NET project named Myproject.sln via command
I have a version controlled project located at ~/webapps/django/myproject and media files located at
trying to understand how custom admin commands work, I have my project named mailing
Here's the setup I have in a vs2008 solution: Data layer in a project
In my project I have to manage large quantity of static text data(ie no
I have been having intermittent trouble with data access so I'm rebuilding my project.

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.