English 中文(简体)
Silverlight 4和WCF的依赖注入/存储库模式
原标题:Dependency Injection / repository pattern with Silverlight 4 and WCF

我们正在创建一个大型Silverlight应用程序。我们已经创建了我们的域模型,包括我们存储库的接口。现在使用WPF,我只需添加对域项目的引用,通过DI容器注册所有依赖项(即存储库),并将存储库注入视图模型中。使用Silverlight,我必须通过WCF服务进行通信,以满足我的所有数据库需求。所以基本上我的存储库接口在Silverlight项目中是无用的。在我看来,我必须在WCF服务中进行所有依赖项注入,并为我的Silverlight应用程序重新包装所有存储库功能。我说得对吗?

最佳回答

这基本上是正确的。理论上,我认为您可以从Silverlight客户端链接到服务器端存储库接口文件,使用WCF服务作为IRepository客户端实现的实际数据源。但是,如果您这样做了,您将不得不使所有接口方法异步,更不用说非常小心地对它们进行编码,以允许环境和对象模型中的细微差异。最终,这很可能是一种值得付出的痛苦。然而,你可以进行实验,看看这是否准确。

问题回答

暂无回答




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签