EntityList / EntityCollection - MVVM 示例

发布于 2024-11-06 01:02:26 字数 442 浏览 10 评论 0原文

我正在使用 April 工具包中的新 EntityList 来公开 ViewModel 中的集合。我还将 FK 公开为 EntityCollections。

我想我会将集合公开为 IEnumerable,它使用通用接口处理集合的公开。这就留下了我绑定到网格/列表的 FK ....我可以使用 EntityCollection 创建带有嵌入对象的可枚举吗?这是“正确”的方式吗?

我还构建了许多用户控件,每个控件都有自己的视图模型。这是否意味着页面应该有一个视图模型,并在其中聚合其他视图模型?每个控件是否应该独立存在,当用户控件嵌入到页面中时实例化它自己的视图模型?

我知道我也可以跳到 POCO 课程,但我的截止日期很紧,并且希望最大限度地减少所有管道代码。

我也是测试代码的新手,但我希望当我有更多时间时,我可以回去填写。

要学的东西太多了,时间太少了!

提前致谢...

I'm working with the new EntityList in the April toolkit to expose a collection in a ViewModel. I also have FK exposed as EntityCollections.

I thought I would expose the collection as IEnumerable, which handles the exposure of a collection using generic interfaces. That leaves the FK that I bind to grids/list .... can I create an enumerable with an embeded object using EntityCollection? Is this the "right" way?

I've also built a number of user controls, each with their own viewmodel. Does this mean the page should have a viewmodel, with the other viewmodels aggregated within it? Should each control stand on it's own, instanciating it's own viewmodel when the user control is embedded in a page?

I know that I could also jump over to POCO classes, but I'm on a tight deadline, and would like to minimize all the plumbing code.

I'm also a newbie on testing code, but I'm hoping that when I have more time, I can go back and fill that in.

So much to learn, so little time!

Thanks in advance...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如果没有 2024-11-13 01:02:26

You might be interested in the BookLibrary sample application of the WPF Application Framework (WAF). It shows how to combine the Entity Framework 4 with MVVM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文