简体   繁体   English

联网的MVVM需要应用说明

[英]networked MVVM Application explanation needed

I'm doing my first WPF / MVVM application which is going to be installed on a networked enviroment, using MVVM I liked the most the OnPropertyChanged thing, lets assume on the Clients I only have the views installed where the ViewModels and Models all at the server, a user now upadted a property on a ViewModel and - for sure - he instantly saw the difference , would this be the same for other users as well ?? 我正在做我的第一个WPF / MVVM应用程序,该应用程序将被安装在网络环境中,使用MVVM,我最喜欢OnPropertyChanged,假设在客户端上我只安装了ViewModels和Models的视图。在服务器上,一个用户现在在ViewModel上更新了一个属性,并且-当然-他立刻看到了区别,其他用户也一样吗? ie a user added a new item and now he can see the new item he just submitted, another user is already using the same window , would he also instantly find that item entered by the first user ? 例如,一个用户添加了一个新项目,现在他可以看到他刚提交的新项目,另一个用户已经在使用同一窗口,他还会立即找到第一个用户输入的项目吗?

Thanks in advance 提前致谢

Musaab 穆萨卜

MVVM uses WPF bindings. MVVM使用WPF绑定。 Bindings only work locally so there is no way for the ViewModel to be at the server. 绑定仅在本地工作,因此ViewModel无法在服务器上使用。 The Model could though, since your View will only bind to the ViewModel. 但是,模型可以,因为您的视图将仅绑定到ViewModel。

So in order to have your idea work at all, you will need a way to let your ViewModel know of any changes in your Model. 因此,为了使您的想法完全起作用,您将需要一种方法让您的ViewModel知道Model中的任何更改。 Since that is not part of MVVM you can choose any solution that fits your needs. 由于这不是MVVM的一部分,因此您可以选择任何适合您需求的解决方案。 Therefore the answer to your question if it would be the same for other users would depend on the solution you choose. 因此,对于其他用户是否相同的问题答案取决于您选择的解决方案。 This is not really a MVVM question. 这不是一个真正的MVVM问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM