从模型生成viewmodel? [英] generate viewmodel from model?
本文介绍了从模型生成viewmodel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在为我的(WPF / C#)应用编写视图模型。
I'm currently writing viewmodels for my (WPF/C#) app.
我必须做很多复制和粘贴操作。没有像从数据库生成模型那样从模型生成视图模型的方法吗?
I have to do a lot of copy and paste though. Isn't there a way to generate the viewmodel from the model like generating the model from the database?
我在网上没有找到任何关于它的信息...
I haven't found anything about it on the net ...
推荐答案
看看Karl Shifflet的 XAML电动玩具。这是一个Visual Studio插件,其中包括用于开发WPF或Silverlight应用程序的各种帮助程序。功能之一正是您要查找的内容:
Have a look at Karl Shifflet's XAML Power Toys. It's a Visual Studio plugin which includes various helpers for developing WPF or Silverlight applications. One of the features is exactly what you're looking for:
- 创建ViewModel类-在VB.NET或C#代码窗口中,轻松创建一个包含命令和公开数据类的ViewModel存根。 (可选)您可以选择重新实现ViewModel上的所有Model属性。
- Create ViewModel Class - from a VB.NET or C# code window, easily create a ViewModel stub that includes commands and exposed data class. Optionally you can elect to re-implement all Model properties on the ViewModel.
这篇关于从模型生成viewmodel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文