EF N-Tier使用WCF [英] EF N-Tier using WCF

查看:107
本文介绍了EF N-Tier使用WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它使用WCF将数据库与UI前端应用程序分开。 MS提供的所有样本都使用桌面隐喻,因为数据库可以直接从UI代码访问(或者重新强化EF为桌面
类似应用程序的事实)。我的问题如下:


1。 EF仅适用于类似桌面的应用吗? Codefirst CTP怎么样?似乎有很多工作要让EF在N-Tier架构中工作,作为本论坛的一些答案。


2。什么是性能影响? 在N层应用程序中使用EF有没有真正的工作示例?


谢谢


hoon

解决方案

Hoon,


< span style ="font-family:Calibri; font-size:small"> 


1。       
EF不是仅用于桌面应用。 
对于n层应用程序,您可以将DbContext / Code First与WCF数据服务和RIA服务一起使用。 
由于CTP版本的性质以及产品的发布节奏,目前这些方案需要一些解决方法,但我们正在努力解决这些问题。 
对于RIA服务,这是一个有用的主题:
http://social.msdn.microsoft.com/Forums/en-US / adonetefx / thread / 57793bec-abc6-4520-ac1d-a63e40239aed
对于数据服务,请查看Rowan的这篇博文:
http://romiller.com/2010/07/19/ef-ctp4- tips-tricks-wcf-data-service-on-dbcontext /
它是为CTP4编写的,但原则也适用于CTP5。 
一个区别是,在CTP中,您使用((IObjectContextAdapter)上下文).ObjectContext获取ObjectContext,其中context是您的DbContext实例。


2。       
这是一个非常普遍的问题。 
您是否有一些特定的性能问题?


 


谢谢,


亚瑟


I have an application that separates the database from the UI front end application using WCF. All samples that MS provides use the desktop metaphor in that the database is directly accessed from the UI code (or re-inforces the fact that EF is for desktop like applications). My questions are as follows:

1. Is EF suited for desktop like applications only ? How about the codefirst CTP ? It seems there is lot of work to make EF work in N-Tier architecture as some of the answers in this forum.

2. What are the performance implications ?  Does anyone have real work examples in using EF in N-Tier type applications ?

Thanks


hoon

解决方案

Hoon,

 

1.       EF is not intended to be used only for desktop apps.  For n-tier apps you can use DbContext/Code First with both WCF Data Services and RIA Services.  Due to the nature of a CTP release and the release cadences around products there are currently some workarounds needed for these scenarios, but we are working to fix those.  For RIA Services, this is a useful thread: http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/57793bec-abc6-4520-ac1d-a63e40239aed. For Data Services, check out this blog post from Rowan: http://romiller.com/2010/07/19/ef-ctp4-tips-tricks-wcf-data-service-on-dbcontext/. It’s written for CTP4 but the principles apply to CTP5 as well.  One difference is that in CTP you get the ObjectContext using ((IObjectContextAdapter)context).ObjectContext where context is your DbContext instance.

2.       This is a very general question.  Do you have some specific performance concerns?

 

Thanks,

Arthur


这篇关于EF N-Tier使用WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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