-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Prism for MVVM #304
Comments
Given the announcements around UWP, Brian Lagunas and I will have to get a good number of things sorted out around navigation. |
Ok, sync'ed with Bart. We'll rally with Brain and Karl as well but the POR is the following.
General hopes are that prism will just role straight in with no additional work since we support two different MVVM frameworks already |
@crutkas Prism is not an MVVM framework. Prism is well-architected guidance for building applications. The guidance is backed up by a framework for implementing that guidance. One of the biggest roadblocks we'll face is how UPW constructs objects. Currently, UPW creates pages when they are navigated to, then resorts to using a view model locator for view model construction. Service locator is an anti-pattern. Additionally, it can't stand up to complex enterprise application demands. Microsoft just released a book: Enterprise Application Patterns using Xamarin.Forms. This book clearly describes using a dependency injection container for Xamarin Apps, the same way WPF and ASP.NET MVC apps have been doing for years. I started using DI in 2008. Unfortunately, UWP does not currently support using DI for page construction. Prism uses a dependency injection container for ALL object construction. This is a well known, universally accepted best practice for building decoupled applications that can easily be modified and maintained over time. Unless we can get the Windows Team to modernize UWP page construction, we'll have to write a Prism Navigation and Frame (or region) components to replace the current UPW implementations. I think it would be a great win for UWP in general, to modernize object construction, follow inversion of control principles, and allow developers to register a container with the application frame/navigation implementation for all object construction. When Prism constructions a page, it also constructs the associated view model and all of the view model's dependencies. In complex apps, view model dependencies can be a complex graph of objects. This is one reason why using a DI container is the best practice. Prism is so much more than an MVVM framework. Looking forward to Skyping and discussing. Best, Karl |
@kdawg1406 Relaying to @timheuer as he might be able to reach out to resources on what you're recommending, as well. |
@kdawg1406 what are your item requests for the platform. I'm not seeing anything listed on https://wpdev.uservoice.com/forums/110705-universal-windows-platform that reference prism. What APIs are missing? Does .NET Standard 2.0 have said APIs in it? |
@crutkas My above post here details what is we need. At the moment, the UWP teams have not prioritized the needs of enterprise developers. DI is just one piece that missing. Let's do this over a skype. |
@kdawg1406 have you actually tried using PRISM for an enterprise application in UWP? It supports DI just fine for VMs. We have a healthcare application with several modules and over 80 pages running just fine with Prism (incl deep linking). There are a few issues with application lifecycle and .NET Native to be solved, but other than that Prism for UWP has been usable for LOB apps for over 2 years now. Doing a full rewrite "just because we can" is a waste of time in my opinion. I'm not even sure where the "full rewrite" is coming from. You are right that the navigation is different compared to Xamarin.Forms since the system uses types to navigate instead of the page instance itself. But that is how UWP works and how Xamarin.Forms works. I have already discussed this with Brian this week and I'll look into what is possible to have a uniform interface between Prism.Windows (UWP) and Prism.Forms. But if that is too complex, it shouldn't keep us from going forward with what we have (and works) to integrate with WTS (which is for UWP). Maybe @timheuer can give us some pointers, but if this isn't in the OS yet, not much we can do to inject pages. |
Let's take this offline and do over Skype |
Expect that some of the integration can be done by extending some of the existing templates to also support Prism. |
adding @tomzorz as he said he was possibly interested in helping. |
We are about to make PRISM available in the nightly build but Will not ship with the 1.5 moving to next milestone. |
Now Prism framework is merged to dev branch and will be available in the next nightly build! |
Verified in dev-nightly: |
It would be a nice feature to have Prism in addition to MVVM Light. It might be a good time to review since it was announced the team might be doing a rewrite for UWP. @kdawg1406
The text was updated successfully, but these errors were encountered: