Services -> Business Layer Interaction RRS feed

  • Question

  • Hi all,

    I am in the midst of re-factoring the services layer in a small / medium size solution and would like to redefine access to the application / business logic.

    The services layer (exposed via WCF) provides application scoped operations through a request / response message pattern. These operations are set at a granularity suitable for the calling application. The business logic is accessed from the services through an application facade which provides finer grained operations.

    The business layer does not contain complex logic (mainly CRUD) however there is a need to accept and return many parameters / results per operation.

    What pragmatic approaches do people recommend for providing extensible messaging between the services and the facade?

    E.g. using another messaging pattern similar to the services

    All thoughts very welcome.

    Saturday, April 28, 2012 10:39 AM

All replies

  • Hi,

    I would say, that you should have the facades in your services as local references. The Facades themself have diffrent ways in that they communicate with your business layer. The easiest yet not most ellegant way would be that they use a instance of your business layer. But this could cause that you have for every request or session an seperate instance of your business logic.

    With WCF you could let your Facades communicate with your Business Layer running in a seperate service or Instance. Alle Requests / Sessions then use the same business layer. For that communication you could use netTcp if they run on diffrent servers or Namedpipes (IPC) if they run on the same machine.

    NamedPipes would be faster than netTvp but is restricted to local calls.

    The extensebility of your facade depends on the way you implemented it. In the first place it is easy to extend because everything you add to your facade is nowhere used.
    Changes to your facade are always a bit harder because they are the same as changing an interface.

    In one place you have to have the complexity of mapping between those two worlds and in my opinion  at the service <-> facade level is the right place and facade is the right pattern.


    Wednesday, May 9, 2012 1:19 PM