Answered by:
Simple question with EF +WC+ database

Question
-
Dear all,
I have an existing database which is accessible though a WCF service. In the current application the database access is handle inside the WCF Service using direct command building and database store procedure call.
I need to update that application by implementing EF.
The thing which is wierd and fuzzy actually for me is that EF is used to build the dabase model and connect to DB, but as in my original application my WCF service is doing so how would be my new approach ?
Will it be as :
-Create a new WCF service class
- Add an ADO.NET Entity modelbut how all of this will work ?
How object will be retrun to client ?
Thnaks for helping me started on this. A clear step by step project sample might help buyt could not find a real one.
Regards
serge
Your knowledge is enhanced by that of others.- Moved by Alan_chenModerator Monday, October 24, 2011 3:16 AM (From:ADO.NET Entity Framework and LINQ to Entities)
Saturday, October 22, 2011 3:17 PM
Answers
-
Here is a link to an answer that was given to describe the differences between the two.
WCF Data Services is a Restful Web Service. You do operations on resources using HTTP verbs.
Both can be used in an enterpise context. The idea behind WCF Data Services is that it will generate queries and updates for you based on your data model. You don't need to write all the the operations other wise for WCF you have to write a method for each CRUD operation you need to do. Each is valid. It all depends on what you are trying to achieve.
Thanks,
Chris Robinson - OData Test Team
This posting is provided "AS IS" with no warranties, and confers no rights.- Proposed as answer by Chris Robinson- MSFTModerator Tuesday, October 25, 2011 4:24 PM
- Marked as answer by Alan_chenModerator Friday, November 4, 2011 6:11 AM
Monday, October 24, 2011 11:41 PMModerator
All replies
-
On 10/22/2011 11:17 AM, Serge Calderara wrote:> Dear all,>> I have an existing database which is accessible though a WCF service. In> the current application the database access is handle inside the WCF> Service using direct command building and database store procedure call.>> I need to update that application by implementing EF.>> The thing which is wierd and fuzzy actually for me is that EF is used to> build the dabase model and connect to DB, but as in my original> application my WCF service is doing so how would be my new approach ?>> Will it be as :>> -Create a new WCF service class> - Add an ADO.NET Entity model>> but how all of this will work ?>> How object will be retrun to client ?>> Thnaks for helping me started on this. A clear step by step project> sample might help buyt could not find a real one.>Each one of the E-commerce solutions use WCF with EF or Linq-2-SQL,which are interchangeable in the solutions. All the clients use the sameBLL/WCF/DAL/EF or Linq-2-SQL. It will show you how to use WCF with an ORM.Saturday, October 22, 2011 9:25 PM
-
On 10/22/2011 11:17 AM, Serge Calderara wrote:> Dear all,>> I have an existing database which is accessible though a WCF service. In> the current application the database access is handle inside the WCF> Service using direct command building and database store procedure call.>> I need to update that application by implementing EF.>> The thing which is wierd and fuzzy actually for me is that EF is used to> build the dabase model and connect to DB, but as in my original> application my WCF service is doing so how would be my new approach ?>> Will it be as :>> -Create a new WCF service class> - Add an ADO.NET Entity model>> but how all of this will work ?>> How object will be retrun to client ?>> Thnaks for helping me started on this. A clear step by step project> sample might help buyt could not find a real one.>I suggest you get Dofactory. Each one of the e-commerce solutions areusing the same BLL/WCF/DAL/EF model. It will show you what you have tohave in place or implemented in your solution by looking at the codeused for each e-commerce solution.Monday, October 24, 2011 3:56 AM
-
One other thing, you want examples. I am giving you the spot where youhave to go to get the knowledge.If I had known where to go get the knowledge like Dofactory on how touse EF with a WCF client and WCF service and what had to be in place, Iwould not have had to sit down for weeks with a lot pain trying tounderstand WCF, use it with EF and starting an application for scratchto be implemented in a company.Do you think people are running around with that kind of knowledge? Notmany know what to do. Dofactory will show you about WCF and EF and howto use it in a client/server environment.Monday, October 24, 2011 4:40 AM
-
Do you want to create a WCF service, or a WCF Data Service? The two are different things. WCF Data Services builds on WCF, making data available though a consistent URL where as WCF you create contracts and typically have methods that return you data, WCF Data Services is Data Centric, WCF is Service or method centric
Thanks,
Chris Robinson - OData Test Team
This posting is provided "AS IS" with no warranties, and confers no rights.Monday, October 24, 2011 8:50 PMModerator -
Actually I have a data base which is access controled by a WCF service which provide contract and method for different things.
Now let say that I am refactoring that layer in order to have it in a better shape and upto date. For instance I was thinking to use EF with my database and then provide access to that database throuh a WCF service which will do the job.
The goal is to place then that service in a remote host that can be accessible though different client type like windows phone, or local application.
Why not having that service side hosted in Azure in annear future.
Now you are pointing something that I am not able to make real difference beween what you call WCF Data Service compare to contract and method ?
both are returning data in a way no ?
As far as I understand WCF data service is more on publishing public data while WCF is mroe for enterprise, is that correct ?
But going through some topic on WCF data serice I can see that we can do all CRUD operation, same as a well done WCF service exposing method...
So what is the real difference between those, as both return data in a way, one through atom pub and the other through SOAP or JSON ?
regards
serge
Your knowledge is enhanced by that of others.- Edited by Serge Calderara Monday, October 24, 2011 10:05 PM
Monday, October 24, 2011 9:04 PM -
Here is a link to an answer that was given to describe the differences between the two.
WCF Data Services is a Restful Web Service. You do operations on resources using HTTP verbs.
Both can be used in an enterpise context. The idea behind WCF Data Services is that it will generate queries and updates for you based on your data model. You don't need to write all the the operations other wise for WCF you have to write a method for each CRUD operation you need to do. Each is valid. It all depends on what you are trying to achieve.
Thanks,
Chris Robinson - OData Test Team
This posting is provided "AS IS" with no warranties, and confers no rights.- Proposed as answer by Chris Robinson- MSFTModerator Tuesday, October 25, 2011 4:24 PM
- Marked as answer by Alan_chenModerator Friday, November 4, 2011 6:11 AM
Monday, October 24, 2011 11:41 PMModerator