建议使用具有WCF服务的自我跟踪实体? [英] Is it recommended to use Self Tracking Entities with WCF services?

查看:78
本文介绍了建议使用具有WCF服务的自我跟踪实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果在WCF服务中推荐使用自助实体(在实体框架中)如果是的话,那么你可以指导一个可以指导如何做的教程吗?

I want to know if using Self Tacking Entities (in Entity Framework) is recommended with WCF services? If yes, then can you guide me to a tutorial which may guide how to do that?

实际上,我将用MEF和MVVM开发一个使用Prism的WPF应用程序。我决定使用实体框架。我想就这个方法提出建议和建议。

Actually, I am going to develop a WPF application using Prism with MEF and MVVM. I have decided to use Entity Framework. I want suggestions and advices regarding this approach.

任何帮助将不胜感激。

推荐答案


我想知道如果使用自助实体(实体框架)是否推荐使用WCF服务

I want to know if using Self Tacking Entities (in Entity Framework) is recommended with WCF services?

这取决于你问谁。如果你问MS,他们会告诉你是的,因为他们根本没有什么更好的提供。 STEs对这个非常古老的 MS Connect建议。问题是EF本身有可怕的不良支持用于合并两个实体图之间的变化(您必须完全自己完成)和在MS平台上工作的开发人员(有时包括我)共享一些常见的行为:

It depends who you ask. If you ask MS they will tell you Yes because they simply don't have anything better to offer. STEs were response to this very old MS Connect suggestion. The problem is that EF itself has terrible bad support for merging changes between two entity graphs (you must do it completely yourselves) and developers working on MS platform (sometimes including me) share some common behaviors:


  • 他们懒惰地开发自己的问题解决方案,他们希望在MS提供的API中直接使用魔法。

  • 大多数时候他们没有受过培训/熟练/他们必须使用技术,因为他们必须经常移动到一个新的技术。

  • 他们知道的唯一API是.NET Framework的一部分。他们不会寻找其他选项,他们都不比较功能。

前两点是MS策略的结果,其中RAD成为设计师的同义词(或者新的也是T4模板)。

First two points are result of MS strategy where RAD become synonym for designer (or newly also T4 templates).

分享 @Richard关于STEs的意见。我会增加STE的一个额外的缺点 - 他们在参与者之间移动大数据集。如果您决定从服务器获取实体图,请更改图中的单个实体并将数据推回,将会再次传输整个图形。转移只有变更的实体导致与STE的核心逻辑的战斗。我也害怕他们在每个实体级别而不是每个属性级别完全跟踪更改。如果对具有较大二进制或字符串数​​据的实体进行修改,则可能导致服务和数据库之间以及服务与客户端之间传输过多的不需要的数据。

I share @Richard opinion about STEs. I would add one additional drawback of STEs - they move large datasets between participants. If you decide to get an entity graph from the server, change a single entity in the graph and push data back they will transfer again the whole graph. Transferring only changed entities results in fighting with STE's core logic. I'm also afraid that they track changes completely on per entity level instead of per property level. In case of modification to entities with large binary or string data it can result in transferring too much unneeded data between the service and the database and between the service and the client.

无论如何,对于具有低数据流量和小实体的简单应用程序,他们可以做得很好,并允许您快速构建应用程序,但不会严格分离问题。您将从服务中获取实体,并将其直接绑定到WPF UI,并且可以跟踪您的更改。后来你会把实体推回服务,他们将能够坚持改变。您的客户端和服务将紧密耦合,但在某些情况下,它可以是足够好的。

Anyway for a simple application with low data traffic and small entities they can do a good job and allow you building your application quickly but without strict separation of concerns. You will get entities from service and bind them directly to WPF UI and they will be able to track changes for you. Later you will push entities back to service and they will be able to persist changes. Your client and service will be tightly coupled but in some scenarios it can be good enough.

这篇关于建议使用具有WCF服务的自我跟踪实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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