Skip to content
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

Closed
shaggygi opened this issue May 11, 2017 · 13 comments
Closed

Add Prism for MVVM #304

shaggygi opened this issue May 11, 2017 · 13 comments
Assignees
Labels
framework The issue is a request to support a specific additional framework. help wanted Issues where external contributors are wanted to help address the issue. Microsoft on point Indicates that community contribution for this issue is not being sort. Typically because it relates
Milestone

Comments

@shaggygi
Copy link
Contributor

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

@ghost
Copy link

ghost commented May 11, 2017

Given the announcements around UWP, Brian Lagunas and I will have to get a good number of things sorted out around navigation.

@mrlacey mrlacey changed the title Feature: Add Prism for MVVM Add Prism for MVVM May 12, 2017
@mrlacey mrlacey added the framework The issue is a request to support a specific additional framework. label May 12, 2017
@mrlacey mrlacey mentioned this issue May 12, 2017
@crutkas
Copy link
Member

crutkas commented May 13, 2017

Ok, sync'ed with Bart. We'll rally with Brain and Karl as well but the POR is the following.

  • Prism team will provide list of items that need to be done to do this right [this may zero]
  • Community can start integrating a PR for support
  • Once Prism had addressed items above, we'll do a full test, and merge in

General hopes are that prism will just role straight in with no additional work since we support two different MVVM frameworks already

@ghost
Copy link

ghost commented May 13, 2017

@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

@shaggygi
Copy link
Contributor Author

@kdawg1406 Relaying to @timheuer as he might be able to reach out to resources on what you're recommending, as well.

@crutkas
Copy link
Member

crutkas commented May 13, 2017

@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?

@ghost
Copy link

ghost commented May 13, 2017

@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.

@bartlannoeye
Copy link
Contributor

bartlannoeye commented May 13, 2017

@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.

@ghost
Copy link

ghost commented May 13, 2017

Let's take this offline and do over Skype

@mrlacey
Copy link
Collaborator

mrlacey commented May 16, 2017

Expect that some of the integration can be done by extending some of the existing templates to also support Prism.
If need help with templates and composition config, create a project that targets MVVMLight and includes all pages and features, then change that project to use Prism. We (I) can then change that project into appropriate templates.

@crutkas crutkas added this to the Backlog milestone May 23, 2017
@crutkas crutkas added the help wanted Issues where external contributors are wanted to help address the issue. label May 23, 2017
@crutkas
Copy link
Member

crutkas commented Jun 7, 2017

adding @tomzorz as he said he was possibly interested in helping.

@crutkas crutkas modified the milestones: 1.5, Backlog Aug 22, 2017
@crutkas crutkas added the Microsoft on point Indicates that community contribution for this issue is not being sort. Typically because it relates label Aug 30, 2017
@ralarcon
Copy link
Contributor

We are about to make PRISM available in the nightly build but Will not ship with the 1.5 moving to next milestone.

@ralarcon
Copy link
Contributor

Now Prism framework is merged to dev branch and will be available in the next nightly build!

@crutkas crutkas added the in-progress The issue is currently being actively worked on. label Dec 15, 2017
@ralarcon ralarcon modified the milestones: 1.6, 1.7 Dec 21, 2017
@ralarcon ralarcon added Can Close Out Soon Work relating to this issue has been completed. and removed in-progress The issue is currently being actively worked on. labels Jan 22, 2018
@sibille
Copy link
Collaborator

sibille commented Jan 26, 2018

Verified in dev-nightly:
Wizard: 0.16.18025.2
Templates: 0.16.18025.2

@sibille sibille closed this as completed Jan 26, 2018
@ralarcon ralarcon removed the Can Close Out Soon Work relating to this issue has been completed. label Jan 30, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
framework The issue is a request to support a specific additional framework. help wanted Issues where external contributors are wanted to help address the issue. Microsoft on point Indicates that community contribution for this issue is not being sort. Typically because it relates
Projects
None yet
Development

No branches or pull requests

7 participants