Answered by:
WCF service to insert XML element values into database!

Question
-
User-34860367 posted
Hi all,
Anyone knows how to write a WCF service that insert data into database using repository pattern, LINQ to Entity Framework, please help me soon.
I can do it in ADO.NET but I am new with above technology. Your time to help me with sample code are much appreciated. I searched online but I am not sure how to start???
I did the following steps:
1. Created a WCF Service Application that take XML string to parse them into XML element values as following:
<SCHOOLRECORD>
<NAME>Robert</NAME>
<GRADE>9</GRADE>
<DATE>1-20-2013</DATE>
</SCHOOLRECORD>
I parsed above XML into three parameters: paramNAME = Robert, paramGRADE = 9 and paramDATE = 1-20-2013. Now I would like to insert element values into SchoolRecord table with columns (id, Name, Grade, Date) where id is unique key which generated from system.
2. I am not sure how to organize the project structure for DAL(data access layer), Entities, Business Logic and how to using Repository pattern for LINQ to Entity Framework. Please help me to get start. Thanks in advance.
Monday, February 4, 2013 9:53 PM
Answers
-
User970350993 posted
Hi
I hope you are knowing the basic concept of WCF. You can get sysntax for Insert/Update/Delete with Database using EF from this post
You can use same sysntax in your WCF Service.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 7, 2013 2:55 AM
All replies
-
User-1000095884 posted
Hi,
If you want to insert data to database using wcf, you need several steps, create a database table, create a WCF service that include a method used to insert data(before this, get each field from the xml), create a application as cleint to test. For details you can refer to this blog.
#Insert Data Into SQL Server Database Using WCF Service
http://www.c-sharpcorner.com/UploadFile/rohatash/inserting-data-into-database-using-wcf-service/
Hope this can help you.
Best Regards.
Tuesday, February 5, 2013 10:38 PM -
User-34860367 posted
Hi,
Thank for your inputs. Your link to insert data into database using ADO.NET not the one that I am looking for. I like to update new technology using LINQ to Entity Framework, repository pattern.
Wednesday, February 6, 2013 4:47 PM -
User970350993 posted
Hi
I hope you are knowing the basic concept of WCF. You can get sysntax for Insert/Update/Delete with Database using EF from this post
You can use same sysntax in your WCF Service.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, February 7, 2013 2:55 AM