locked
how to develop WCF Service using Entity framwork 5 (or) 6 in N-tier Arch RRS feed

  • Question

  • We have requirement to develop WCF Services using Entityframework 6.0.

    Could some one please suggest whether developing WCF Services using Entityframework 6.0 in N-Tier Architecture is a good idea? If yes please suggest me best way or N-Tier Architecture to do that.


    Friday, May 9, 2014 9:08 AM

Answers

All replies

  • I have no problem using EF 6 in an MVC N-tier solution. I don't think I would have a problem with EF6 hosted by a DAL or Repository sitting behind a WCF service and DTO(s) are being used. EF is just doing simple CRUD operation due to the usage of DTO(s).

    http://visualstudiogallery.msdn.microsoft.com/655aa6d4-4461-42ea-aeec-64cdb1313de7

    http://www.dofactory.com/framework/framework.aspx

    Each one of the 4 UI(s) of Windows form, MVC, ASP.NET and WPF are using the same Service Layer (WCF) BLL and DAL with the DAL using EF, and those DTO(s) are being used too. Dofactory will show you N-Tier, using WCF and EF.

    Saturday, May 10, 2014 9:52 AM
  • You can have a WCF service that interacts with DB using EF. The WCF service should accept function calls using the DTO and then forward this to a Repository. The repository can then implement transaction and other required support to execute the operation.

    the service input/output parameters should be defined using plain DTO that supports DataMember attribute applied to required properties.

    The overall design of repository can be abstracted through a Interface and can take advantage of Factory pattern to create instances of specific entities.

    The WCF layer will sit on one serve and might interact with the DB server. Depending upon your needs you may decide to pull your DAL in its own server.


    Pravin Chandankhede

    Wednesday, June 4, 2014 11:36 AM