473,325 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Updating data using LINQ to SQL and Web Services

balabaster
797 Expert 512MB
Does anyone have experience integrating LINQ into SOA architecture. I've spent all night trawling through documents and books regarding this and I've come to the conclusion that I'm going about things incorrectly...

I've got my database and imported my DBML to set up my data context. I've got a bunch of web methods to transport data back and forth from the db to my ASP.NET page at run time (using AJAX).

The page itself holds a fair whack of data displaying it in a manner not dissimilar to a windows app. In order to achieve the most usable application, I thought that serialization and deserialization of data objects built from sections of the page and passing them back through AJAX calls would be the best way to go.

So imagine if you will as a simplified example a contact database - that's not what I've got, but it's an easy example to demonstrate the point. My page displays my user header information and a custom ascx for each of their pieces of contact information. When a piece of contact info is modified, rather than causing a postback, I'm serializing the contact from that object and sending the XML back to a SaveContact webmethod on my web service that deserializes the object, attaches it to the database context, and then submits the changes.

At least, that's what is supposed to happen...

Thus far, I've got my selects, inserts and deletes working just fine. The issue comes when trying to update existing items in the database. After I've deserialized the contact object, I come to attach it to the data context and my application blows up with one of a number of errors depending upon how I try and achieve this. They range from "Cannot insert an entity with a key that is already in use" to "An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported."

Can anyone comment on the pattern I'm using and if this is possible, or have I just been too ambitious with my expectations of LINQ for multi-tier applications? What I've read is that this is not possible, but according to Microsoft's MSDN site, this is exactly the type of architecture LINQ was targetted at... which means that I'm missing something.

Does anyone know the correct way to go about this?
Oct 15 '08 #1
1 1653
kenobewan
4,871 Expert 4TB
Came across this article, not sure if it is helpful:
Linq up that Webservice
Oct 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
3
by: adam222 | last post by:
hello, i have a web-form with a GridView control, i wanted to update & delete, using the AutoGenerateEditButton. when i used it with sqlDataSource (executing SP in the DB) it works like a...
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
13
by: G | last post by:
Hello, Looking for opinions on a fairly simple task, new to ASP.net (C#) and want to make sure I do this as efficiently as possible. I have a web based form, and I need to run some SQL before...
7
by: =?Utf-8?B?Q2hha3JhdmFydGh5?= | last post by:
Today, after watching the presentation by Amanda Silver at http://channel9.msdn.com/Showpost.aspx?postid=335058 , from Channel 9, started exploring the LINQ features. Surprisingly, few facts...
15
by: EDBrian | last post by:
My problem is this. Our clients create different fields they want to collect and we allow them build dynamic filters, reports etc... We run some TSQL to actually create the column and all works...
13
by: Matthias S. | last post by:
hi there, i have generated a database model using vs and a *.dbml file. there are a lot of tables in the database and all of them are prefixed, like xxCustomers, xxOrders. for the generated...
0
by: wzvh3c | last post by:
I have created a DataSet from a Database. I perform a LINQ query and get a subset of the data I am interested in and that data is in an array, the resulting array is bound to a grid. If I make a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.