What is the difference between Bussiness Entity and Data Contract ?

Topics: General Discussion Forum, July and December Releases Forum
Feb 12, 2008 at 4:13 AM
Edited Feb 12, 2008 at 7:56 AM
HI,
I am beginner in WCF.
I am using webservice factory for creating wcf services. Here is a bit of background on what I'm doing:
1. I created a data contract using thw wizard and in the end it generates a class with data members..
2. I created a service contract(Consider ICategory), which consist of 2 operations, namely Register and Delete,
3. I created connection to the database, as well as stored procedure.

Here it is, my doubts.....

1. Whether we have to create a seperate service/Class for database connection.
2. How can we retrive information and Insert information into the DB ?
3. What does the Bussiness Entites actually does..?
4. How can we make use of the stored procedure ?

I anybody could demonstrate it using some examples, it would be of great help ....

Thanks and Regards
Nimesh Prabhakar


Developer
Feb 12, 2008 at 11:23 AM
Hi Nimesh,
You can find some guidelines and examples along with code-gen in the Repository Factory (http://codeplex.com/repositoryfactory). This should give you some answers to 1,2 and 4.
Regarding #3, you can consider in this case a you have the BusinessLogic layer that acts as a kind of "adapter" that will get your data from a DC and call the data access logic using the Business Entities defined in your domain. So the DataContracts define the data structure that will be exposed to the service consumer in a way that will decouple the underlying Business Entities of your domain so they only be shared among your business components.

CF