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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:43:54+00:00 2026-05-27T13:43:54+00:00

Can using Modules or Shared/Static references to the BLL/DAL improve the performance of an

  • 0

Can using Modules or Shared/Static references to the BLL/DAL improve the performance of an ASP.NET website?

I am working of a site that consists of two projects, one the website, the other a VB.NET class library which acts as a combination of DAL and BLL.

The library is used to communicate with databases and sometimes transform/validate the data going into/coming from the DBs.
Currently each page on the site that needs db access (vast majority) will create an instance of the relevant class in the library to access specific tables.

As I understand it this leads to a class from the library being instantiated and garbage collected for each request, with the possibility of multiple concurrent instances if multiple users view the same page.

If I converted the classes to modules (shared/static class) would performance increase and memory be saved as only one instance of each module exists at a time and a new instance is not having to be created for each request?

(if so, does anyone know if having TableAdapters as global variables in the modules would cause problems due to threading?)

Alternatively would making the references to the Library class it the ASP.NET page have the same effect? (except I would have to re-write a lot less)

  • 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-27T13:43:54+00:00Added an answer on May 27, 2026 at 1:43 pm

    I’m no expert, but think that the absence of examples of this static class / session object model in books and online is indicative of it being a bad idea.

    I inherited a Linq-To-Sql application where the db contexts were static, and after n requests the whole thing just fell apart. The standard model for L2Sql is the Unit-of-Work pattern (define a task or set of tasks – do them and close). Let the framework worry about connection pooling and efficient GC.

    Are you just trying to be efficient or do you have performance issues? If the latter it’s usually more effective to look at caching or improving query efficiency (use stored procedures, root out queries in loops) than looking at object instantiation.

    Statics don’t play well with unit tests either (another reason why they have dropped out of fashion).

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

Sidebar

Related Questions

Is there any way I can avoid using array_flip to optimize performance. I am
I am using ASP.NET MVC to develop an application framework. Essentially, the end goal
So I'm using static class members so I can share data between class methods
I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally
Does anyone have experience using the URL Rewrite Module (see here )? Can it
I'm storing some additional per-user information using the AUTH_PROFILE_MODULE . We can access the
How can I using group by with union in T-SQL? I want to group
I can browse using the desktop browsers via ..localhost:54647/... and from windows mobile emulators
All I can find using fopen() and fwrite() in C is to delete all
I have a simple 3D cube that I can rotate using the following code:

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.