在屏幕完成处理(加载和计算计算的属性)之后调用代码? [英] Call code after the screen has finished processing (loading and computing computed properties)?

查看:95
本文介绍了在屏幕完成处理(加载和计算计算的属性)之后调用代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题类似于DateTime<-> DateTime2问题:我的数据在保存时(由sql server)更改了,我想以编程方式/自动方式忽略/接受此更改.

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.

我将xml数据存储在服务器上的xml列中.对于服务器上的xml列,我定义了一个架构.这导致服务器重写xml(字符串)(例如跳过空格和更改名称空间).没关系,我不知道该怎么办 避免它.

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.

我是Lightswitch,但是在保存后,我在已编辑的datagrid行上收到了数据更改通知'*',因为lightswitch从服务器重新加载了数据并检测到上述更改.

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.

由于其他原因,我希望再进行一次SaveChanges(而不是Discard).以下代码可以解决问题

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();

this.DataWorkspace.MyData.SaveChanges();

但是我不知道该放在哪里.将其放入screen_Saved()方法不起作用,因为调用该方法为时过早,并且尚未发生数据的重新加载.

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)?

推荐答案

我可以看不到您能够强迫LightSwitch以您想要的方式进行处理(我认为 保存的方法是您对樱桃的最后一句话,可以这么说).数据 已经更改,因此LightSwitch正在执行正确的操作.通常,很难使LightSwitch做正确"以外的事情.

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".

我要做的是将该表包装在RIA服务中(您可以在其中执行任何操作),从而使LightSwitch可以与RIA服务提供的实体正常运行.

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.


这篇关于在屏幕完成处理(加载和计算计算的属性)之后调用代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆