locked
Call code after the screen has finished processing (loading and computing computed properties)? RRS feed

  • Question

  • Hi,

    my problem is similar to the DateTime <-> DateTime2 problem: my data gets changed on save (by the sql server) and I want to ignore/accept this change programmatically/automatically.

    I store xml data in an xml column on the server. For the xml column on the server, I have a schema defined. This leads to a rewrite of the xml (string) by the server (like skipping whitespaces and changing namespaces). This is ok and I don't know how to avoid it.

    I Lightswitch however, I get a data changed notification '*' on the edited datagrid row after save, because lightswitch reloads the data from the server and detects the above mentioned changed.

    For other reasons I would prefer to do a second SaveChanges (and not a Discard). The following code does the trick

    this.DataWorkspace.MyData.SaveChanges();

    but I don't know where to put it. Putting it in the screen_Saved() method does not work, because it is called too early and the reload of the data has not happened yet.

    Is there a way to call code after the screen has finished processing (loading and computing computed properties)?

    Wednesday, January 16, 2013 11:00 PM

All replies

  • I can't see you being able to force LightSwitch to handle this the way you want(I think the Saved method was your last bite at the cherry, so to speak). The data has changed, so LightSwitch is doing the correct thing. It's often very hard to make LightSwitch do something other than what is "correct".

    What I would do is wrap that table in a RIA Service (where you can do whatever you like), allowing LightSwitch to function normally with the entity provided by the RIA service.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    • Proposed as answer by Angie Xu Friday, January 25, 2013 3:25 AM
    Thursday, January 17, 2013 12:49 AM
    Moderator