How to architect this n-tier ASP.NET solution?

I have a problem setting up my VS solution, and I would like some suggestions.

Currently, my solution layout is as follows: -

Foo.Models
Foo.Repositories
Foo.Services
Foo.Web (an ASP.NET MVC application)

my site ( Foo.Web) calls various methods in the namespace Foo.Services. The idea here is that it Serviceshandles all the business logic. A namespace Modelis just objects POCO. Repositoriesnamespace is a stand alone explanation.

Constructor dependency injection with interfaces handles the black magic of which layer requires which component.

Problem: I want to add some Windows Workflow Foundation (WWF) project code to the solution, but put this WWF code in the same Foo.Services.dll.

For this I need to do another type project Workflow. This workflow has actions that call the Foo.Services methods. Thus, my website should now call either the services method or the workflow methods to do something.

I was hoping the site would only ever call a namespace Servicesto do something.

After all, a service is the main interface between a user interface and business logic, IMO. The fact that I technically use WWF should not be a problem for someone coding in the IUI.

Because a workflow DLL calls methods in the Services dll, DLL Services cannot call methods in Workflow due to a circular dependency.

DLL Services, dll ( Workflow Windows).

, , ?

, Services - , - WWF ?

WWF , ? . , WWF - ?

, .

HomeController.cs
public ActionResult Index()
{
   // StockService was created using constructor dependency injection.
   var viewData = _stockService.GetStocks(StockType.MostPopular);
   return (viewData)
}

StockService.cs
public class StockService : IStockService
{
    public IEnumerable<Stock> GetStocks(StockType stockType)
    {
        // Dependency Injection defines if the Pipeline is WWF
        // or something else (eg. plain ole functions).
        var stocks = _stockPipeline.GetStocks(stockType);

        // Cache result.

        // Update repostiory. (example of calling the repository)
        _sqlRepostiory.SaveSomeRandomData("Jon Skeet Was Here.");

        return stocks. // Returns a POCO.
    }
}

.

+5
3

Rob Connery MVC Storefront/Kona ? WF, . , . , Workflow Foundation .

+1

'Application'

Application ---> Services
                    ^
                    |
            \--> Workflow

. , .

0

FYI. , Workflow. .

0

All Articles