开发者

Silverligtht WCF enabled service with Prism

开发者 https://www.devze.com 2023-04-09 12:38 出处:网络
Im required to write a Silverlight application using WCF. I\'m also required to use Dependency Injection to gain access to this service in another library.

Im required to write a Silverlight application using WCF.

I'm also required to use Dependency Injection to gain access to this service in another library.

(I add a Silverlight enabled WCF Service)

The problem is in trying to use Dependency Injection (Prism/MEF in this case). When I make a Silverlight Shared library that will have interfaces for this service, I cannot add this library in the ASP.Net project due to the fact that it is Silverlight library. If I make a non-Silverlight library I cannot add that librar开发者_如何学运维y to other projects to share that common interface.

Basically I need a library I think to share between projects in Silverlight so I can do this service injection.

Any information is appreciated


As slugster said - this done via linking to windows library files from silverlight library.

You do it as described here: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/20/linking-files-in-visual-studio.aspx

I just wanted to add.. Since you go there - what you need is another Framework/Technology. Usually those classes you talking about depend on other classes/namespaces that live in windows only or silverlight only world. And then you need to transfer object data via wire.

Microsoft's solution to this - RIA Services. What it does - it takes your Windows classes and generates proxy classes on Silverlight side. Kind of what you need. And it works with WCF services.

There is 3rd party solutions like CSLA and DevForce. I use DevForce and it does many things automatically, but instead of generating proxy classes - it creates links just like what you want.


Whether you realise it or not, your question is a duplicate of this one: Shared data object between WCF service and Silverlight app While not asked the same way, the answer is the same.

You need to create a separate project, and share the code files (as links) from one project to the other. Your problem is that the Silverlight project is compiled for a different runtime to the ASP.NET/WCF project. Because they cannot reference a common library, linking the shared files as mentioned is the easiest way to share code between the two projects targetting different runtimes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号