Search Wiki:
This is a sample code for starters for understanding WCF and MVC.
Mostly targeted to understand WCF

1 Created a Data Class Library
This is used to get data from any database.
I used some sample data which i hardcoded for the example. You can get the values from any DataBase as required.
This layer is used to fetch data as an object which will be created in a seperate library (Here its EmployeeModel library)

2. Created EmployeeModel library (This acts as a model object for MVC)

3 Created a WCF Service Library.
Added EmployeeService.cs and IEmployeeService.cs with one method.
Added Employee.cs contracts file for the library.
Changed the Service Contracts to point to EmployeeServiceLibrary.EmployeeService
Modified the End Points to connect to EmployeeServiceLibrary.EmployeeService contract.
Creaed a new contract to use EmployeeServiceLibrary.EmployeeService
Connected this application to the data class library created to fetch the data.
Tested the application.

4 To host the above created WCF Service Library we need to create a WCF Service Application Website.
In this we need to remove the unnecessary classes and add the reference to the above WCF Service Library and change the
Service.svc file to point to EmployeeServiceLibrary.EmployeeService contract and open the serice.svc file in browser to test the application.

5 Now use the svcutil.exe utility to create the web.config and ClientService connection files copy these to the client project and test the application
**************

Modififed the code and added in 1.0.1 release
Modifications...
Add Update Delete a MVC employess
Fetching data from .mdf file.



Last edited Dec 11 2009 at 9:18 PM  by aditya, version 5
Updating...
Page view tracker