locked
Using WCF service in the business layer RRS feed

  • Question

  • Halo,

    In our application we have the following projects contained in one solution:

    The business project (layer):
    Here we have stored out object, service interfaces, services and nhibernate mapping files.
    We make use of Castle windsor when we use the the services. Communication is done via Rhino and Nhibernate.

    Then we have several other WCF Service projects:
    All projects have one svc file doing some specific operations.

    The web project:
    Here we have a ASP.NET MVC project that makes use of the services contained in the business project.

    Now we need to make use of one of these WCF services in the business layer.

    It doesn't feels right to just add a hard dependency in the business project on one of the WCF services.

    What is the best way do make use of the WCF service in the business layer? How can this be achieved using DI/IOC ?

    Thanks

    Monday, November 23, 2009 10:51 AM

Answers

  • You can find a good description of service layer in Application Architecture Guide book:
    http://www.codeplex.com/AppArchGuide

    Vitaliy Liptchinsky http://dotnetframeworkplanet.blogspot.com/
    • Marked as answer by Riquel_Dong Monday, November 30, 2009 2:42 AM
    Monday, November 23, 2009 2:44 PM

All replies

  • Hello,

    If I correctly understood your question, all you need is to add a Service Layer, or a Facade, which will "hide" all those services.
    Vitaliy Liptchinsky http://dotnetframeworkplanet.blogspot.com/
    Monday, November 23, 2009 11:13 AM
  • Yes indeed,

    But the only is that we already have some kind of service layer, performing the business logic in our model.
    I think it's weird that I should create another "service" layer that makes use of my WCF services.
    Maybe it's better to just convert all the services in our model to WCF services.
    But that would cost a lot of time at this point I think..
    Monday, November 23, 2009 11:32 AM
  • What do you mean by "convert all the services in our model to WCF services"?

    Vitaliy Liptchinsky http://dotnetframeworkplanet.blogspot.com/
    Monday, November 23, 2009 12:31 PM
  • Currently in our business project we already have a service layer with services like for instance, OrdersService
    This will basically perfom business operation and access the database via Rhino/NHibernate

    Next to this we created several WCF services that were necessary for clients that were talking to our application.

    Now it has gotten a bit messy
    Normally we should of went from the WCF service to the internal service to the database.
    This was not done strictly enough and now we need access from the business service to an operation in the WCF service (in a different project)

    Do you understand what I mean?
    Monday, November 23, 2009 1:17 PM
  • Here is a bit mess with terms.
    But service layer should contain only, so to say, technical knowledge - communication over the wire (WCF contracts), security, logging, etc.
    Services like OrdersService are purely business logic items, these services should not reside in service layer.
    Vitaliy Liptchinsky http://dotnetframeworkplanet.blogspot.com/
    Monday, November 23, 2009 1:25 PM
  • You don't happen to have some good articles covering this design implementation?
    Monday, November 23, 2009 1:51 PM
  • You can find a good description of service layer in Application Architecture Guide book:
    http://www.codeplex.com/AppArchGuide

    Vitaliy Liptchinsky http://dotnetframeworkplanet.blogspot.com/
    • Marked as answer by Riquel_Dong Monday, November 30, 2009 2:42 AM
    Monday, November 23, 2009 2:44 PM
  • Thanks
    Monday, November 23, 2009 3:08 PM