Future of Prism with Unity Container #2624
Replies: 2 comments 2 replies
-
Ultimately this isn't something that we can answer outright at the moment. This will be something that @brianlagunas and I will talk about on an ongoing basis. For now, it is safe to assume that DryIoc will be the only container supported for Prism.Maui particularly as we needed some features that were slated for Unity 6 to support MS DI/Shiny. We will also likely add an updated deprecation notice for all Unity Container based packages. Do note that there are some differences between the Unity Container and both Autofac and Ninject which we have previously deprecated. Autofac was deprecated due to them fundamentally changing the way the container behaved from a mutable to an immutable container. That pattern simply cannot support Prism Modularity. Ninject was effectively abandoned during the swap to netstandard, and no usable package was ever produced that would properly support all platforms. In the case of the Unity Container, there are some missing features which would help developers for sure, however the package itself remains stable and usable for continued use at this time. It will ultimately up to you and your team whether you want to take a dependency which includes the Unity Container as a now deprecated package. For many enterprises this will create a security concern and they would want to look at using DryIoc or implementing IContainerExtension for their container of choice. Lastly let me address the question is this something the Prism Community can help with? The short answer is that neither @brianlagunas or I will be taking on the additional workload of supporting a DI container. We are both already over extended. The deprecation of the Unity Container is a good reminder for all in the .NET Community that they need to stand up and help support OSS Maintainers. We do have day jobs that we rely on to support ourselves and our families. That will ALWAYS take priority over an OSS project. Whether for Prism, the Unity Container or any other OSS project you depend on there are several ways that you and your employer can support OSS.
|
Beta Was this translation helpful? Give feedback.
-
After reading the original post from Martin Egli, which was somehow alarming for me because I also have two rather large Prism+WPF projects that rely on Unity, I gave it a try to replace Unity with DryIoc in one of them. For the most part it was quite easy, after getting used to the semantics of DryIoc. There were some tricky spots, but fortunately with some reading of the documentation I was able to make them work as well. The most important thing is to understand the differences in the lifetime management so that after the transition singletons are still resolved as singletons and transient instances as new instances. If Unity in the application is accessed over the IoC abstraction layer of Prism it becomes fairly easy to migrate even big solutions to DryIoc. In trying this with the aforementioned application, I also found some benefits in doing so. Some registration code got more readable and also the performance of the application got slightly improved. In case you are interested, I found this benchmark of most .NET IoC Containers, which also shows that in terms of performance a migration to DryIoc could be beneficial. |
Beta Was this translation helpful? Give feedback.
-
The UnityContainer project will not be developed further. What is the future of Prism? We have already lost compatibility with Autofac in the past. Is DryIoc the last IoC container? Can prism Comunity help the Unity Container project?
Beta Was this translation helpful? Give feedback.
All reactions