locked
Any WCF Data Service + Business Layer Patterns? RRS feed

  • Question

  • Hi All, 

    I have just started dabbling with WCF data services and not sure how I have to integrate my business layer.

    UI --> WCF Data Service --> EF --> DB  is my current architecture.

    I need to integrate my Business logic into the above architecture. My business layer would have Business Logic + Validations + Workflow Initiation.

    What I want is UI --> WCF Data Service --> Business Layer --> EF --> DB  is what I want.

    Are there any examples around how I could integrate my business layer using ODATA service? For this kind of architecture, is WCF Data service recommended? What are the other ways I could develop a REST based service if WCF Data service doesnt fit my needs?

    A simple picture of how I use my components. 

    *-----------------*
                                 
    *   Database      *
                                 
    *-----------------*

                                 
    *------------------------*
                                 
    * DAL(Data Access Layer) *
                                 
    *------------------------*

                                 
    *------------------------*
                                 
    * BUL (Bussiness Layer)  *
                                 
    *------------------------*
                                 
    *---------------*  *-------------------*
                                 
    * My OData stuff*  * Internal API      *
                                 
    *---------------*  *-------------------*

     
    *------------------* *------------------*

    * Web Application  * * Internal Client--*

     *------------------* *------------------*

    Thanks.





    Tuesday, March 20, 2012 10:54 PM

Answers

All replies

  • Hi,

    Ideally, you would have your data service right in front of your EF. That is what your data service does well. I think your architecture needs to be

    UI-WCF Service-WCF Data Service-EF-DB instead of what you have mentioned. The WCF service can be REST based as well.

    Hope this helps.

    Tuesday, March 20, 2012 11:38 PM
  • That means my reads will be on the Data Service and my writes will go thru the WCF Service so I can add my business logic inside the WCF service?

    UI-WCF Service-WCF Data Service-EF-DB

    Are there any samples around with this kind of archtiecture?

    >> The WCF service can be REST based as well.

    I see that REST is being moved to asp.net so dont want to end up using a not supported technology. 

    Wednesday, March 21, 2012 12:06 AM
  • Hi,

    My go to will be Patterns & Practices. Take a look at this link

    http://msdn.microsoft.com/en-us/library/ee658090.aspx

    and this

    http://msdn.microsoft.com/en-us/library/ee658127.aspx

    They both have guidelines around how your Service layer and your data layer can be architected.

    Wednesday, March 21, 2012 5:43 PM