I stumbled upon a framework promising a powerful and flexible infrastructure, named Kephas, and I am currently evaluating it for an existing application to get it updated to the latest technologies. I just browsed the documentation and the samples and I can see the potential for new applications, but what about existing ones? Is it possible to implement an incremental strategy and not rewrite it from scratch? Does anyone know about it, what was the experience?
问题:
回答1:
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.
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:
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.
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.
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.
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.
Disclaimer: I am the lead developer behind the Kephas Framework - more information can be obtained from the Wiki page. Check also the samples here.