且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有人知道凯法斯吗?

更新时间:2022-06-13 22:20:26

如果应用程序使用版本高于4.5的.NET框架(实际上是.NET Core/.NET,则可以肯定)可以逐步完成.标准和单声道也受支持).实际上,有些组织将其用于生产,并逐步将其集成.还有一些架构问题需要考虑周全,例如DI框架或数据持久层的集成,但是从根本上来说,逐步采用应该不会造成任何严重的问题.

Sure it can be done incrementally, provided the application uses the .NET framework with a version higher than 4.5 (as a matter of fact .NET Core/.NET Standard and Mono are also supported). In fact, there are organizations using it for production which integrated it step by step. There are also architectural issues which need to be considered thoughtfully, like the integration of a DI framework or a data persistence layer, but basically the incremental adoption should not pose any serious problems.

不要忘记Kephas Framework的核心是可通过依赖项注入获得的应用程序服务.使用默认提供的值,或仅通过单纯的属性覆盖它们.您可以采用更多方法:

Do not forget that central to Kephas Framework are the application services available through dependency injection. Use the ones provided by default, or override them, just by the means of a mere attribute. You can follow more approaches:

  • 使原始应用程序的DI容器与Kephas提供的容器并存(顺便说一下,这只是对现有DI的一种抽象,我们不想重新发明***).不太推荐,但是如果您想那样的话就可以使用.

  • Have the original application's DI container live side by side with the one provided by Kephas (by the way, it is only an abstraction over existing DIs, we didn't want to reinvent the wheel). Not very recommended, but it works if you want to have it that way.

已将原始应用程序的DI容器集成了Kephas的DI容器.在与ServiceStack的Funq DI容器一起使用时,我亲自使用了此策略,并且该方法有效.但是,通过这种方式,原始应用程序可以访问Kephas服务,但无法访问.如果您需要控制原始应用程序,我会使用这种方法.

Have the original application's DI container integrate the one from Kephas. I personally used this strategy when working with ServiceStack's Funq DI container and it worked. However, this way the original application has access to Kephas services, but not the way round. I would use this approach if you need to let the original application be in control.

已将Kephas集成了应用程序的DI容器.这样,Kephas服务可以访问原始应用程序的服务,但是无法访问原始应用程序的服务.如果您现在或将来要完全走Kephas路线,我会使用这种方法.

Have Kephas integrate the application's DI container. This way Kephas services have access to the original application's services, but not the way round. I would use this approach if you want to walk the Kephas way completely, now or in the future.

完全使用Kephas提供的DI容器.如果您根本不使用DI或拥有兼容的DI容器(例如MEF/System.Composition或Autofac),那么我会采用这种方式-对于Autofac,它没有内置的支持,但是实现起来应该不那么困难).

Use the DI containers provided by Kephas entirely. I would go this way if you don't use DI at all or have a compatible DI container (like MEF/System.Composition or Autofac - for Autofac there is no built-in support but it shouldn't be that hard to implement it).

有很多事情要讨论,但这超出了这个问题的范围.

There are a lot of things to discuss, but this would go beyond the scope of this question.

免责声明:我是Kephas Framework的主要开发人员-有关更多信息,请访问 Wiki页面.还要在此处中检查示例.

Disclaimer: I am the lead developer behind the Kephas Framework - more information can be obtained from the Wiki page. Check also the samples here.