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

  • Home
  • SEARCH
  • 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 306729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:29:38+00:00 2026-05-12T07:29:38+00:00

I would like to build a DLL (which should be accessed from a web

  • 0

I would like to build a DLL (which should be accessed from a web service and possibly from another application through automation).

Is there any possibility using NHibernate inside this dll (so accessing the dll through automation would work) ?

I am already using NHibernate in a rich client application and it is very handy , but I have to make some changes to the app.config for this. All the other tutorials I see are using NHibernate directly on the web service – and are changing the web.config accordingly.

  • 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-12T07:29:38+00:00Added an answer on May 12, 2026 at 7:29 am

    If you configure NHibernate in code rather than using app.config or web.config you should be able to avoid the problem you describe. For example you could use Fluent NHibernate’s Fluent Configuration feature to configure NHibernate and thus avoid use of both web.config and hibernate.cfg.xml, which potentially could cause some trouble as well.

    I am currently using this approach in a web app, where the data access layer is in a separate assembly and the web assembly has no reference to NHibernate and needs no modification to web.config, nor is a hibernate.cfg.xml file used.

    Here is an example of a Fluent configuration:

    sessionFactory = Fluently.Configure()
        .Mappings(x => x
            .FluentMappings.AddFromAssemblyOf<FooMap>()
            .ConventionDiscovery.AddFromAssemblyOf<BarConvention>()
            )
        .Database(MsSqlConfiguration.MsSql2005.ConnectionString(x => x
            .Database("YourDbName")
            .Server(@".\SQLEXPRESS")
            .TrustedConnection())
            .ShowSql())
        .BuildSessionFactory();
    

    Update:

    The same goal should be possible to achieve using only standard NHibernate, by using their programmatic configuration possibilities. Instead of using the web.config or such to configure your database connection etc. you could pass an IDictionary instance to Configuration.SetProperties() when you create your session factory.

    Something like this:

    Configuration config = new Configuration();
    
    IDictionary properties = new Hashtable();
    properties["hibernate.dialect"] = "NHibernate.Dialect.MsSql2005Dialect";
    // more properties here ...
    
    config.SetProperties(properties);
    

    Chapter 3 of the docs has some info about this, but it is a bit on the short side.

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

Sidebar

Ask A Question

Stats

  • Questions 163k
  • Answers 163k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to put it inside an object with the… May 12, 2026 at 12:08 pm
  • Editorial Team
    Editorial Team added an answer I think you require a new flavour of master/slave -… May 12, 2026 at 12:08 pm
  • Editorial Team
    Editorial Team added an answer as yoda says in the comment, don't put a /… May 12, 2026 at 12:08 pm

Related Questions

I've got the following nonstandard setup (VS2008, .NET 3.5 SP1): There is a main
I need to build a simple webservice to get data in and out of
I have written some code that makes use of an open source library to
I have a scenario where I have multiple versions of the same assembly that
I'm putting a large codebase into Team Foundation Server. I would like the build

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.