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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:37:04+00:00 2026-05-26T01:37:04+00:00

I am designing an internal web application that will have 3 layers: Presentation (MVC)

  • 0

I am designing an internal web application that will have 3 layers:

  1. Presentation (MVC)
  2. Service & Workflow
  3. Data Access / Persistent Storage

Initially the application will run in a simple 2-tier environment. However, at some point I want it to be able to easily expand/scale to 3 tiers, one for each layer.

I could simply use WCF services for the Service layer but I have found considerable overhead to calls, even using named pipes (IIS hosted). I would prefer to have a solution that can be configured to use local DLL calls in the 2-tier style but use WCF calls in the 3 tier style.

I believe DI works well here but I’m looking for someone who has done this to explain any potential pitfalls with this method.

  • 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-26T01:37:05+00:00Added an answer on May 26, 2026 at 1:37 am

    i think you’ve nailed it with the DI suggestion. also the repository pattern will help you here.

    firstly, write an interface which will wrap all the calls to the as-yet-undefined third layer. this will be our contract to code against (do not confuse this with WCF data contracts, they will exist separately.

    //use a more descriptive name of course
    public interface IThirdLayer {
        void SomeRepositoryMethod(SomeArg arg);
    }
    

    then write two concrete implementations of this interface, one for your local repository (perhaps SQL calls), one for the remote repository (perhaps using a service reference or the ChannelFactory class). these classes will encapsulate all your logic for the third layer,.

    In any class which wishes to make use of this layer, simply pass an implementation of IThirdLayer:

    public class SomeBusinessLogicClass {
    
        private readonly IThirdLayer _repository;
    
        //constructor injection for the win!
        public SomeBusinessLogicClass(IThirdLayer repository) {
            _repository = repository;
        }
    
        public void SomeBusinessLogicMethod(SomeArgs arg) {
            //example use of repository
            _repository.SomeMethod(arg);
        }
    }
    

    because we’re coding against a contract (the interface IThirdLayer), and supplying that contract via the constructor, our business logic layer does not need to aware of any details of the implementation of the third layer i.e. whether it be WCF, SQL, or even File-based.

    you could also use your favourite dependency injection container to help you here, this will provide the configuration that you need. personally i use microsoft’s Unity, but there are many options available so i won’t post example configuration.

    hope that’s helpful.

    edit: i forgot to quell your fears of pitfalls with this approach. other than having to write a few extra classes to achieve the abstraction you need, there are no other pitfalls really. this is the kind of pattern you can repeat over and over for all sorts of scenarios, not just this one. it is always good practice to code against an interface, even if there is only ever going to be one concrete implementation of said interface in your production code.

    Why is this so? the reason is that you can easily switch implementation if you ever need to in future, and also because you will often have another implementation of said interface in your unit tests – whether it be a handwritten mock implementation, or an implementation dynamically generated by a mocking framework (i use Rhino Mocks). so another benefit of this approach is testability, in unit tests you supply test-specific implementations of your Repository’s interface – meaning your business logic can be tested in isolation with no dependencies on concrete classes.

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

Sidebar

Related Questions

We are designing a .net web application that has an external and internal site.
I'm designing a database for internal use at my company that will store data
I am designing a Restful web service for an internal corporate application, and am
I am designing a simple internal framework for handling time series data. Given that
I am designing a method that will add an element to an internal list.
Let's say you are designing a web application for internal business use. Should a
We are designing a solution that will be used on an internal network. One
I am designing a web service which will call different external web services according
The application that I'm designing will retrieve and store content from a variety of
I am designing a WPF application that uses a DLL with maybe 40 public

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.