Silverlight: Use of a local WCF service for business logic (intermediate WCF Service)? (Ria services in conjunction with a normal WCF Service?)

我的梦境 提交于 2019-12-25 04:48:11

问题


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.

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..

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.

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 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.

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

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.

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??

Thanks in advance


回答1:


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.

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.



来源:https://stackoverflow.com/questions/4644311/silverlight-use-of-a-local-wcf-service-for-business-logic-intermediate-wcf-ser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!