我可以将ESQL字符串发送到WCF服务,查询EF并返回STE吗? [英] Can I send an ESQL string to a WCF Service, query EF and return STE's?
问题描述
我需要在我的数据访问层中使用WCF服务方法,该方法可以接收ESQL字符串,查询实体框架,然后返回自我跟踪实体的集合。如果客户可以随后对STE的
进行更改,然后调用不同的服务方法,并使用ApplyChanges / SaveChanges将更改保存到EF,那就太好了。
1)我可以"挂钩"吗?一个EntityCommand对象,需要一个EntityConnection,以及EF的ObjectContext? 或者我应该只打开EntityConnection而不使用EF ObjectContext,例如:
使用(EntityConnection conn =
new EntityConnection(" name = MyEntities" ) )
{
conn.Open();
。 。 。
2)以及如何将EntityDataReader返回的行作为自我跟踪实体返回? 我是否需要实例化STE in-code然后填充来自EntityDataReader的'属性一个一个'? (哎哟 - 我的应用程序将
有几十个STE)
谢谢!
DT
I need a WCF Service method in my Data Access tier that can receive an ESQL string, query Entity Framework and then return a collection of Self Tracking Entities. And it would be nice if the client could then make changes to the STE's and then invoke a different Service method to persist the changes to EF using ApplyChanges/SaveChanges.
1) Can I "hook up" an EntityCommand object, which needs an EntityConnection, with the ObjectContext of EF? Or should I just open an EntityConnection and not use the EF ObjectContext, like:
using (EntityConnection conn =
new EntityConnection("name=MyEntities"))
{
conn.Open();
. . .
2) And how can I return the rows returned by EntityDataReader as Self-Tracking Entities? Would I need to instantiate the STE in-code and then populate its' properties one-by-one from the EntityDataReader? (ouch - my app will have dozens of STE's)
Thanks!
DT
Try this: http://msdn.microsoft.com/en-us/library/ee789839.aspx
这篇关于我可以将ESQL字符串发送到WCF服务,查询EF并返回STE吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!