Answered by:
Set a property on the server side?

Question
-
Hi.
I am quite new to WCF RIA Services. I have an entity with some string properties. E.g. Person.SpecialCode1, Person.SpecialCode2.
On my Silverlight client, a new Person is created. I want the user to click a button, and Person.SpecialCode1 and Person.SpecialCode2 to be set on the server side and their value shown on the client, without the new Person object being saved to the database.
At first I thought a named update would be perfect for this, as it can be done asynchronously, any number of "Person"s properties can be set on the server, I can access the Person's navigation properties and the properties that I set are automatically shown on the client. However to do a named update I need to call SubmitChanges which means that my new Person will be Saved.
Any ideas on how to achieve this will be greatly appreciated.
Thanks!
- Edited by Kurren123 Monday, March 25, 2013 11:12 AM
Monday, March 25, 2013 11:01 AM
Answers
-
You can't send the entity back to the server without the SubmitChanges. What you can do is use an Invoke method to retrieve the SpecialCode1 and SpecialCode2 values and then set them to your entity client side.
http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k
- Edited by Colin Blair Monday, March 25, 2013 3:32 PM
- Proposed as answer by Md. Shohel Rana(Shipon) Saturday, March 30, 2013 2:27 AM
- Marked as answer by Amy PengMicrosoft employee, Moderator Monday, April 1, 2013 7:56 AM
Monday, March 25, 2013 3:32 PM
All replies
-
You can't send the entity back to the server without the SubmitChanges. What you can do is use an Invoke method to retrieve the SpecialCode1 and SpecialCode2 values and then set them to your entity client side.
http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k
- Edited by Colin Blair Monday, March 25, 2013 3:32 PM
- Proposed as answer by Md. Shohel Rana(Shipon) Saturday, March 30, 2013 2:27 AM
- Marked as answer by Amy PengMicrosoft employee, Moderator Monday, April 1, 2013 7:56 AM
Monday, March 25, 2013 3:32 PM -
Thank you for your reply.
SpecialCode1 and SpecialCode2 will be calculated by accessing the navigation properties of Person. E.g. Person.Address. Which particular properties will be accessed may change in the future. Is there any way to achieve this?
Monday, March 25, 2013 4:50 PM -
Not really, you just need to pass all of the properties to an Invoke.
I think this is an important pattern to support and it is on the project plan for Open RIA Services but for the moment there is no good clean solution.
http://www.riaservicesblog.net | RIA Services and MVVM http://bit.ly/pgL97k
Monday, March 25, 2013 5:22 PM