Silverlight:将本地 WCF 服务用于业务逻辑(中间 WCF 服务)?(Ria 服务与普通 WCF 服务结合使用?) [英] Silverlight: Use of a local WCF service for business logic (intermediate WCF Service)? (Ria services in conjunction with a normal WCF Service?)

查看:24
本文介绍了Silverlight:将本地 WCF 服务用于业务逻辑(中间 WCF 服务)?(Ria 服务与普通 WCF 服务结合使用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的 Silverlight 调用我的 WCF 服务并且它工作得很好.这是一个 WCF(不是 ria)服务,基本上返回实体或实体集合.

I have my silverlight calling my WCF service and its working great. This is a WCF (not ria) service that basically returns enitites or collection of entities.

我真的无法控制它为例如 Silverlight 添加其他项目.

I really don't have control over it to add additional items just for silverlight for example.

所以我在想,但也许它的性能或设计很差..

So i was thinking but maybe its bad performance or desgin..

但是要在托管 Silverlight 的 Asp.net 网站上托管本地 WCF 服务.而且我可以将此 wcf 服务用于不需要返回实体的业务逻辑.例如,silverlight 可以调用服务器,然后服务器可以使用 PURE .net 执行某些操作.

But to have a local WCF Service hosted with the Asp.net website that hosts silverlight.. ANd i can use this wcf service for business logic that doesn't need to return entities. For example so silverlight can call to the server and then the server can do something with PURE .net.

当然,我仍然需要我的 Silverlight 来与返回实体等的外部 WCF 服务对话.

Of course i still will need my silverlight to talk to my External WCF service that returns entities etc..

如果有的话,最好的实现方式是什么..

What would be the best way to implement this, if at all..

Silverlight 调用本地 WCF 服务,而IF REQUIRED"本地 wcf 服务调用外部 WCF 服务(返回实体等),所有内容都返回到链中.

Silverlight calls local WCF service and "IF REQUIRED" local wcf service calls external WCF Service (which returns entities etc) and everything is returned back down the chain.

或 Silverlight 根据需要调用本地 WCF 服务或外部 WCF 服务.

or Silverlight calls to local WCF service or to external WCF service depending on what is required.

有第三个选项,但我正在大声思考,也许它不适合......但是拥有 RIA 服务,所以 Silverlight 可以调用这个......但我再次无法摆脱或控制我的另一个wcf 服务...所以silverlight 需要调用两个或ria 服务可以调用wcf 服务...但这是我有疑问的地方...因为RIA 服务通常返回IQUERYABLE 例如...我的wcf 服务返回ILIST例如,如果 ria 服务调用我的 wcf 服务,它将收到一个 ILIST .. 因此,ria 服务中的 [QUERY] 属性要求我返回 IQUERYABLE,但这是不可能的,因为我已经在一个 ILIST 中.

There is a 3rd option but i am thinking aloud and maybe it wouldn't fit... But to have RIA services so silverlight could call this .... but again I CANNOT get rid of or have control over my other wcf service... So silverlight would need to call both OR ria services could call the wcf service ... But this is where i have a doubt... because RIA services normally return IQUERYABLE for example... My wcf service returns ILIST for example so if ria services called to my wcf service it would receive back an ILIST .. hence the [QUERY] attribute in ria services require me to return IQUERYABLE but it isn't possible because i am already in an ILIST.

我真的很感谢一些关于天气的反馈,我完全没有抓住重点,或者事实上这是一个好主意.

I would really appreciate some feedback to weather i am completely missing the point or infact its a good idea.

事实仍然是,silverlight 有时需要在服务器上执行标准操作,但与数据访问或实体无关……我无法控制外部 wcf 服务,因此我不能只插入专门用于需要时银光..

The fact remains that silverlight sometimes needs to do standard stuff on the server but has nothing to do with dataaccess or entities... i have no control over the external wcf service so i can't just insert a new method specifically for silverlight when its needed..

有人使用类似的系统,优点/缺点吗??

Anybody use a similar system, PROS / CONS??

提前致谢

推荐答案

我认为您的应用程序应该只使用 Ria 服务,然后 Ria 服务应该连接到外部服务.然后所有逻辑都在服务器上,您的 SL 应用程序具有使用服务的简单模型.你可以认为所有的业务逻辑都在服务器上.

I think your application should use only Ria Services and then Ria service should connect to the external service. Then all logic is on the server and your SL app has simple model of using services. You can think about is as all business logic is on the server.

返回 IQueryable 怎么样,您总是可以使用 linq 将列表转换"为 IQueryable,但我认为您可以从 RIA 服务返回列表 - 这应该不是问题.

What about returning IQueryable you always can "convert" list to IQueryable using linq, but I think you can return list from RIA Service - it shoudn't be a problem.

这篇关于Silverlight:将本地 WCF 服务用于业务逻辑(中间 WCF 服务)?(Ria 服务与普通 WCF 服务结合使用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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