带有Smart Client Winform应用程序的IoC / DI框架:我应该如何处理? [英] IoC/DI frameworks with Smart Client Winform apps: How should I approach this?

查看:190
本文介绍了带有Smart Client Winform应用程序的IoC / DI框架:我应该如何处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在启动一个新的Winforms应用程序,并且打算使用IoC / DI框架(可能是Ninject,但我也在考虑StructureMap和LinFu)。

I'm starting a new Winforms app, and I intend to use an IoC/DI framework (probably Ninject, but I'm also thinking about StructureMap and LinFu).

似乎几乎每个使用IoC / DI的人都在基于Web的环境中这样做,并且几乎没有发现将Winforms与它一起使用。

It seems like nearly everyone who is using IoC/DI is doing so in a web based environment and have found virtually nothing on using Winforms with it.

d想知道是否有人在Winforms上使用IoC / DI,以及您用来处理Winforms相关问题的方法(例如,如何使容器在应用程序的各个部分中可用,您是否使用框架实例化您的表单等。)

I'd like to know if anyone is using IoC/DI with Winforms and what approaches you used to deal with Winforms related issues (for instance, how do you make the container available in various parts of the app, do you use the framework to instantiate your forms, etc..)

如果有人知道任何使用IoC / DI的基于Winforms的开源项目(无论使用哪个框架,我都应该能够翻译

If anyone knows of any open source Winforms based projects that use IoC/DI (doesn't matter which framework, I should be able to translate concepts) I would like links to those as well.

编辑:

人们只是不写Smart Client吗?不再吗

Are people just not writing Smart Clients anymore?

编辑:

如果您可以指出一些使用IoC / DI的实际代码, Winforms或什至是控制台类型的应用程序(例如,不是基于Web的应用程序),我都非常感谢。

If you could point me to some real-world code that uses IoC/DI in a Winforms or even console type application (ie, something that is not Web based) I'd appreciate it.

编辑:

我一直在使用Ninject并发现,如果您指定IKernel构造函数参数,Ninject将愉快地注入其公共内核接口的实例。效果很好,但是我仍然想听听人们使用的其他方法。

I've been using Ninject and discovered that Ninject will happily inject an instance of it's common kernel interface if you specify an IKernel constructor parameter. This has been working out pretty well, but I'd still like to hear other approaches people use.

推荐答案

我刚刚开始使用IoC的StructureMap从零开始编写新的WinForms应用程序。我以前看过SCSF和CAB,但是发现它们过于复杂。

I just recently started writing a new WinForms application from scratch using StructureMap for IoC. I've previously looked at SCSF and CAB, but found those overly complex.

我在StructureMaps注册表之上编写了一些流利的API,以便我们的模块可以注册命令,演示者和

I wrote some fluent APIs on top of StructureMaps registry so our modules can register commands, presenters and views.

根据我的经验,在所有方面都值得付出努力,如果不想再次使用这些工具和高度结构化的模块化方法,我绝对不想编写WinForms应用程序

From my experience it has been worth the effort in all regards, I would never want to write a WinForms app without using these tools and the highly structured modular approach again.

这篇关于带有Smart Client Winform应用程序的IoC / DI框架:我应该如何处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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