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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:28:33+00:00 2026-05-13T16:28:33+00:00

I have just re-implemented an ASP.NET web application that uses NHibernate to use a

  • 0

I have just re-implemented an ASP.NET web application that uses NHibernate to use a session per request (using an IHttpModule). The SessionFactory is created at the start of the application using a connection string from the web.config file. The SessionFactory is then stored and sessions created and released using a thread-safe, lazy singleton.

This means that if say 20 users are using the application the same user (as specified in the connection string in web.config) is used when creating any connections to the database – is this best practice? Will SQL Server Express complain about the number of connections eventually? (as connections are created and released per request this may not be a concern in practice).

In my old architecture a connection was created using the user name of the current user – is there any advantage to this (perhaps if there is are security restrictions for the logins of each different user).

When using a thread-safe, lazy singleton (like below) which contains the SessionFactory and manages sessions, I believe this is available site wide wide e.g. 2 users accessing the application from different PCs will use the same instance?

public static NHibernateSessionManager Instance
{
  get
  {
    return Nested.NHibernateSessionManager;
  }
}


private class Nested
{
  static Nested() { }
  internal static readonly NHibernateSessionManager NHibernateSessionManager =
    new NHibernateSessionManager();
}
  • 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-13T16:28:34+00:00Added an answer on May 13, 2026 at 4:28 pm

    It’s definitely a best practice if the goal is to increase performance. Using one connection string enables connection pooling.

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

Sidebar

Related Questions

I just discovered that every request in an ASP.Net web application gets a Session
I have an ASP.NET MVC2 application that uses a parent controller to setup specific
I have a web application built in asp.net mvc using forms authentication. I am
I've just started using the MVP pattern in the large ASP.NET application that I'm
I have just added routing in a new asp.net 4 web forms application, and
In my ASP.NET web-application I use NHibernate to persist my User-Instances, where each of
I have just implemented WMD for my editor in an ASP.NET app. The problem
I have just put implemented Facebook connect on my web-site using the JavaScript SDK.
I've just started working on a brownfield ASP.NET 2.0 Web Application. As with a
I have implemented GZIP compression on a few of my ASP.NET pages, using a

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.