[RESOLVED]Where to write repository Pattern in MVC+WCF project?

Hi Folks,

Wanted to learn Repository Pattern implemenation in my project whic has following structure.

Web – MVC4

Services – WCF + EF5

So in all my controller actions will make a call to WCF service to get the Models

Models are shared across WCF & MVC projects. (WCF & MVC are in diff solutions all together).

So, nmow I wanted my project to have Repository Pattern for Data Access which is in WCF.


Currently my Service is defined like below with methods.

 public bool SubmitManfLocationrequest(Request req)
            using (LASORContext dbcontext = new LASORContext("xx"))
            return true;


        public List<Request> GetAllMFLRequests()
            List<Request> AllMFLRequests = new List<Request>();
            using (LASORContext dbcontext = new LASORContext("xx"))
                AllMFLRequests  = dbcontext.Requests.ToList();
                return AllMFLRequests;

any suggestions on converting this to Repostiory in WCF Service side?

WCF service serving the data, so it is feasible to have a DAL in the service with Repository implementation.

MVC app acts as the client, sends request to WCF service to perform CRUD.



At the above blog article I walked through the repository pattern implementation.

* Note that regardless of the technology (WCF or Web API) the pattern implementation is same.

Let me know any further queries.

Hi Ram,

About repository and unit of work patterns, you also could refer to:

# Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application


Best Regards

Starain Chen

Leave a Reply