Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service with asp.net mvc application

I have started using asp.net MVC and as traditional way I want to keep my data access layer in WCF service. How can I achieve that using asp.net MVC ?

Scenario

I started a test application in asp.net MVC which Displays, Inserts and Edit data. I successfully created that by adding 'ADO.Net Entity Data Model'.

So now if I wanted to move this dataaccess layer in WCF service, i.e. a WCF service with methods like GetData(), UpdateData(), CreateNewData(), how can i achieve that?

like image 578
Miral Avatar asked Jun 03 '09 08:06

Miral


People also ask

What is WCF in ASP.NET MVC?

In this article This article helps you resolve the Windows Communication Foundation (WCF) problem where calls timed out if you create the WCF service host inside ASP.NET Model View Controller (MVC) controller. Original product version: Windows Communication Foundation 4.0, Microsoft .NET Framework 4.0.


1 Answers

Short Answer:

You just need to move your dataaccess layer into a WCF service, expose it and then call it from your MVC application.

Long Answer:

1) I recommend going through Scott Guthrie's Nerd Dinner walkthrough to get a really good understanding of MVC basics.

2) The following blog goes through the process of writing a Layered ASP.NET MVC Applicaiton with a WCF Service (Parts III & IV specifically concentrate on WCF & MVC interaction):

  • Part I (General Concepts)
  • Part II (Building a Repository)
  • Part III (Building The Service)
  • Part IV (Using The Service)

I haven't read the linked arrticles in detail (just skimmed them) but they seem to give a decent overview of the process.

like image 120
mundeep Avatar answered Sep 22 '22 23:09

mundeep