How to do a server-side Insert/Update (Upsert) from Silverlight RIA services

While RIA services seems very good for table operations & queries, I am stuck on one traditional update situation. The UPSERT (Update if exists, else Insert new):

First: I want to add a record server-side if the record does not already exist, otherwise if it already exists, I want to update one of its current field values.

Second: I do not want to query the database from client-side, to see if the record exists. I just want to call an "UpsertData" method on RIA services and have the add or update occur server-side only.

I have tried many options, the closest I got used an [Update(UsingCustomMethod = true)] method, passing a newly created (therefore detached) Entity. When call the method with my object I get: "A custom method cannot be invoked on a Detached Entity."

Suggestions on the best way to do this would be appreciated :)

1
задан Gone Coding 12 November 2010 в 11:48
поделиться