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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:37:31+00:00 2026-06-09T12:37:31+00:00

At work we’re about to re-write an old application and I was told to

  • 0

At work we’re about to re-write an old application and I was told to get some ideas about how we could do it.

My idea is the following:

Since the application will be mainly a website I’d use MVC. EF with POCO entities for DI and IoC. WCF for the services that the web app and other clients will be consuming.

So far the architecture should look like this:
– Demo.Web
– Demo.Entities
– Demo.Services

Now my architecture looks like this:

namespace Demo.Entities

// IEntity.cs
public interface IEntity { }

//User.cs
public virtual long UserId { get; private set; }
public virtual string Name { get; private set; }

public User() { }
public User(long userId, string name)
{
    UserId = userId;
    Name = name;
}

namespace Demo.Services

// IService.cs
public interface IService<T> : IDisposable where T : IEntity
{
    List<T> GetList();
}

// UserService.cs
public class UserService : IService<User>
{
    public List<User> GetList()
    {
        return new List<User>(); // Simplicity
    }

    public void Dispose() { }
}

When I need to use this I would do:

using(IService<User> service = new UserService())
{
    var q = service.GetList();
}

As for MVC, I will use the models from Demo.Models, and if need to have the actual models I will link them to my Models folder of my MVC application, but now MVC is my last concern.

So far I’ve detected one issue, I won’t be able to query multiple entities without instantiating the specified service. On the bright side I have full control of what and how my data is being handled.

Actual question

If any, can anyone point me to any architectural design to support these features?

  • 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-06-09T12:37:32+00:00Added an answer on June 9, 2026 at 12:37 pm

    I am a big fan of the SOLID architecture principles described here and here. They are worth checking out and spiking before you make a final decision. DotNetJunkie will also be posting another blog entry about how to use these patterns with WCF sometime in the not-too-distant future. The interfaces and patterns he describes are decoupled enough to use them with either EF or NHibernate.

    One concern I see with your post is the IEntity interface. I don’t think you need to have an interface for your base entitiy, usually an abstract base class is enough (i.e. using the Layer Supertype pattern). I have never found a reason to make all entities subscribe to a single interface contract.

    I also don’t see any dependency injection in your examples. Any code that uses using(IService<User> ctx = new UserService()) is taking a dependency on the interface AND the implementation. You want your MVC or other client code to take a hard dependency only on the interface, and have concrete implementations resolved/injected by your inversion of control container. This is a pattern that is common in the Onion Architecture that trailmax posted about.

    I do like your idea of having a “tripod” of projects. Try not to let the project count in your solution get bigger than about 5 projects though (excluding unit test projects, those don’t count).

    So far I’ve detected one issue, I won’t be able to query multiple
    entities without instantiating the specified service. On the bright
    side I have full control of what and how my data is being handled.

    Again these concerns can be handled by reading and adopting the ICommandHandler and IQueryHandler / IQueryProcessor patterns described in the articles I mentioned above. You do not have to instantiate any services at all. You just constructor-inject either IQueryProcessor or ICommandHandler<TCommand> into your controller, and let the IoC container provide the implementation. If you have an operation that needs to query multiple entities, you just do that by accessing either EF or NHibernate in your query’s Handle method.

    Here is an example of one of my projects that uses these patterns:

    MyApp.Domain.csproj

    Class library that contains all entities as well as the DotNetJunkie interfaces, and command + query implementations. This takes no dependencies on Entity Framework or any of the other projects.

    MyApp.Impl.csproj

    Class library that contains implementations of interfaces, as well as the EF DbContext and the IoC container. This takes dependencies on the Domain project as well as EF, the IoC library, etc.

    MyApp.Mvc.csproj

    The MVC project takes dependencies on the other two.

    This is a very basic example of the Onion Architecture.

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

Sidebar

Related Questions

Work on this small test application to learn threading/locking. I have the following code,
Work on the following website: http://cetcolor.com The masthead graphic with the Read About It
Work on C#, in one of my application I need to get the SQL
I work on an Android app, what should simply post some information about the
Work on C# Desktop project,I have an account on paypal ,From my desktop application
I work directly on a remote (S)FTP Server some times. I use textmate as
Work on C# .I want to inherit generic class for this purpose i write
Work on C#.In my application several time need to select\collect datafrom DB.Fro this task
work on Sql server 2000. i want to get the current server date and
I work for a very large organization that is looking for new ideas. Currently

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.