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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:46:57+00:00 2026-05-13T22:46:57+00:00

I am developing a couple of small ASP.NET application and would like to know

  • 0

I am developing a couple of small ASP.NET application and would like to know what pattern. approach do you use in your projects.

My projects involve databases, using Data access and Business logic layers.

The data-access approach that I was using so far is the following(I read in some book and liked it):

For DAL layer:
Creating an abstract class that will define all database manipulation methods to implement.
The abstract class will contain a static “Instance” property, that will load (if instance == null) an instance (Activator.CreateInstance) of the needed type (a class that implements it).

Creating a classes that implement this abstract class, the implementation will be according to the databases (SQL, mySQL and etc) in use.
With this I can create different implementation according to database in use.

For BLL layer:
A class that encapsulates all all retrieved fields , and static methods that will call the DAL classes.

Is it a good approach?
What do you prefer to use in those situations?

  • 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-13T22:46:58+00:00Added an answer on May 13, 2026 at 10:46 pm

    By using static class methods, you’re hiding dependencies on these components and limiting your options in the future (you can’t subclass your business layer, for example).

    Instead of using singletons and static methods for your data access and business layers, consider changing your business layer class to require a data access instance, and keep a single instance of the business layer in your top level application:

    public class Global HttpApplication {
    
        // This would really be a property
        // It's also unfortunate this has to be static, but you're stuck with
        // default constructors for ASP.NET pages, so there's no alternative.
        public static BusinessLayerClass BusinessLayer;
    
        protected void Application_Start(object sender, EventArgs e) {
             AbstractDataAccessLayer dataAccess = new ConcreteDataAccessLayer();
             Global.BusinessLayer = new BusinessLayerClass(dataAccess);             
        }
    }
    

    Pages then use it like this:

    public void PerformSomeBusinessFunction() {
        Global.BusinessLayer.DoSomething();
    }
    

    This makes it obvious that your business layer requires data access, provides a convenient place to specify which type of data access object it will use, and paves the way for you to use different creational strategies if they become necessary. For example, you might supply a data access factory instead of sharing a single instance across all your business layers.

    The general principle here is called “dependency injection” (sometimes it’s referred to as “inversion of control”, which is the even-more general principle behind DI.)

    If this dependency injection by hand starts to get cumbersome, consider using a dependency injection framework (people also call these “IoC containers”).

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

Sidebar

Related Questions

I've a couple of extension methods I've been developing for a couple of projects,
Developing a .NET WinForms application: how can I check if the window is in
When developing a desktop application in .NET, is it possible to not require the
I'm currently developing a small business database application for which we plan to go
I'm currently developing a small WPF application using a file database (SQLCe). Since I'm
I'm developing an application (winforms C# .NET 4.0) where I access a lookup functionality
I have been developing websites for a couple of years now and I almost
Developing websites are time-consuming. To improve productivity, I would code a prototype to show
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
When developing a new web based application which version of html should you aim

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.