在一个分层架构的实体框架是什么? [英] Entity framework in a layered architecture?

查看:193
本文介绍了在一个分层架构的实体框架是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

否则周围WCF和实体框架一些实验。一对夫妇的问题。

Doing some experiments around WCF and Entity Framework. A couple of questions.

选项1:

据我所知,实体框架类,可起连载过WCF直接,带SP1。如何过,我想知道怎么样延迟加载,预先加载,环境管理等方面的情况在此的处理,如果他们在所有的处理呢?

I understand that entity framework classes can be serialized over WCF directly, with sp1 onwards. How ever, I would like to know how scenarios like delay loading, eager loading, context management etc is handled in this, if they are handled at all?

选项2:

另一种方法是使用EFPocoAdapter,会对实体框架之上的纯POCO包装,而不是直接暴露实体框架类。 HTTP://$c$c.msdn.microsoft.com/EFPocoAdapter 。有没有人用这个?任何思考这个方向?

Another alternative might be to use EFPocoAdapter, to have a plain POCO wrapper on top of the entity framework, instead of exposing entity framework classes directly. http://code.msdn.microsoft.com/EFPocoAdapter . Has anybody used this? Any Thoughts in this direction?

其他的想法:

有关ADO.NET数据服务 - 据我了解ADO.NET数据服务无法在远程(nettcp绑定)配置?它仅支持HTTP的访问。我们都知道,二进制序列化速度较慢。

About ADO.NET data services - As I understand ADO.NET data services can't be configured over remoting (nettcp binding)? It supports only http based access. We all know that binary serialization is slower.

任何指针或任何其他的选择吗?

Any pointers or any other options?

推荐答案

我已经做了一些挖这一点,这里是我的发现这一点。

I've done some digging on this, and here are my findings on this.

ADO.NET数据服务:

您可以使用ADO.NET数据服务(您需要SP1)暴露你的实体框架通过线路,几乎为零code。但据我所知,唯一的限制是,该交易是通过HTTP。这意味着,有一个小脑袋上系列化方面(大家都知道二进制序列化速度较快),但优点是实现我们服务的速度。

You can use ADO.NET Data services (you need SP1) to expose your Entity framework over the wire, with almost zero code. But as I understand, the only limitation is, the transaction is over HTTP. That means, there is a small over head in terms of serialization (we all know binary serialization is faster), but the advantage is the speed of implementation for our services.

我是从约翰[ http://twitter.com/John_Papa ]一个非官方的字就这一点 - 肯定更多的选择与WCF,更多的工作在大多数情况下也。道夫暴露出实体很容易。PERF差异时可以忽略的大多数情况下,

I got an unofficial word from John [http://twitter.com/John_Papa] on this - "Definitely more options with wcf. More work in most cases too. Astoria exposes entities easily. Perf diffs are negligible in most cases"

的优势 - 你并不需要在所有写任何服务 - 您只需勾验证并围绕数据服务和实体框架的安全逻辑,我们正在做。理想的,如果你正在消耗数据中心的服务通过HTTP - 在场景就像一个Silverlight客户端,或一个WinForm / WPF前端通过HTTP

The advantages - You don't really need to write any services at all - You can just hook the validation and security logic around the data services and entity framework and we are done. Ideal if you are consuming data centric services over http - in scenarios like having a silverlight client, or a winform/wpf front end over http.

暴露实体框架在WCF:

随着SP1的,有很多的用人单位框架分层体系结构支持。这包括预先加载和上下文管理支持。当然,在这种情况下,我们需要编写服务(以及后面我们的方法的逻辑)。或者,如果我们有实体框架模型与DB神韵完全,我们就可以产生大多数的服务,其中包括我们所需要的方法。

With SP1, there is lot of support for employing entity framework in layered architectures. This includes support for eager loading and context management. Of course, in this case, we need to write the services (and the logic behind our methods). Or if we have the entity framework model totally alligned with the db, we could generate most of the services, which includes the methods we need.

推荐您阅读这篇 http://msdn.microsoft.com/en -us /杂志/ cc700340.aspx

另一种方法是使用EFPocoAdapter,有对DTOS实体框架之上的纯POCO包装,而不是直接暴露实体框架类。现在它是一个指南针项目的实体框架 HTTP下一个版本:// code。 msdn.microsoft.com/EFPocoAdapter

Another alternative might be to use EFPocoAdapter, to have a plain POCO wrapper on top of the entity framework for dtos, instead of exposing entity framework classes directly. Right now it is a compass project for next version of Entity framework http://code.msdn.microsoft.com/EFPocoAdapter.

这篇关于在一个分层架构的实体框架是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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