Finally I almost understood this pattern, the only thing that nobody mentions is the SERVICE! Nobody tells about services but this is the key for understanding MVVM pattern! With knowing about the service responsibility everything makes sense now because now you can understand how you actually generate your incoming and outcoming data like literally, the bytes of information. Thank you fir this video.
@johnallcock5582 Жыл бұрын
the suggestions made in this video about which bars of MVVM(S) make easily the most sense on this subject than I have found anywhere else. Well done.
@keigezellig9 ай бұрын
I am doing some MAUI development lately (and have previous experience with MVVM) and this is EXACTLY the architecture i am using! 😊
@JamesMontemagno9 ай бұрын
Great to hear!
@lucecarter2 жыл бұрын
As someone who regularly references your code samples to help me with various code scenarios, I instantly knew what the S stood for, before I even clicked on the video. You're officially an influencer! Hahah
@typhoonf62 жыл бұрын
Just wanted to say thanks James 👌started my foray into Xamarin and MAUI a year or so ago now, just as a personal hobby. Your videos/repos have been invaluable and it's always nice to learn the right way to do something the first time. Cheers!
@romanbohun97212 жыл бұрын
I use practically the same pattern with some variations. Some layers could be added here but it depends on project size and complexity. Glad to see that you do the same things. Thank you for sharing!
@johnmcnulty10222 жыл бұрын
What layers would you add Roman?
@krccmsitp28842 жыл бұрын
Makes total sense and it's as I always understood MVVM, thinking of the S(ervices) implicitly.
@jutyarr2 жыл бұрын
pretty nice as always James, for those who are new or confused, please watch "The Xamarin Show | Episode 13: MVVM Helpers" by james
@yosimadsu21892 жыл бұрын
Your MVVMS is actually the easiest way to approach app design. Thanks a lot 👍👍👍
@Ash_Industries9 ай бұрын
James, these videos have really inspired me to learn C#, Xmal, .Net, Maui......and now MVVMS lol
@vincentotieno91972 жыл бұрын
Thanks for this. I love MVVM and this is practically what I've always done. For serious applications I always separate the Models into their own project, which also includes the service interfaces (not their implementation).
@namelastname40772 жыл бұрын
yup. you can mock up your services much easier
@AlSavant2 жыл бұрын
"Model" can be understood in different contexts depending on which abstraction layer in your architecture you're describing. Typically people refer to it as the object model (the business logic of your application) or the data model (the state of the application). MVVM's take on model is that of the object model which is a higher abstraction layer than the data model which you present in your video. Their choice for that is deliberate: MVVM architecture describes the abstraction layers touching the View, it's an architectural pattern for creating applications with UI elements. "M" in MVVM is meant to be "just the business logic" implying there will also be services, factories, and of course data models, but the architecture does not care about describing the Model, it's up to each programmer to implement according to the needs of his/her application. MVVM more specifically is a reply to the MVC and MVP patterns, all of which describe the interaction between UI views and the model, and all of which refer to the object model as the definition of the "M" in their respective letter soups. Having said that, I have nothing bad to say about your way of setting up your projects, it's just that it's still MVVM, the M sucks up the S implicitly.
@ZeeshanAhmad-q8o3 ай бұрын
Finally, I almost understand about MVVM. Thanks James.
@Armonica1967 Жыл бұрын
Very very good explanation!!! You have very clear concepts and you know how to transmit them. I have understood in your explanation what I have not understood in other tutorials. Congratulations!!! Greetings from Madrid, Spain!!! 👍👍👍👍😀😀
@HijiHakimaru2 жыл бұрын
There are sooooo many "personal opinions" that I agree with and practice as well. I never really could quite name the "pattern" I use since it was just something that developed over time. Before this video, I was calling it a pseudo micro-services or service-oriented architecture with some MVC mixed in (because of using MVC project type, then Blazor WASM), which turned into a "maybe I really am using something more akin to MVVM since the controllers are "dumb controllers" that just forward the request to the server-side service implementation. In any case, MVVM-S it is:-). Thanks so much for another great informational video!
@gerryan97102 жыл бұрын
I also used that pattern and it was really easy to maintain.
@michaelrogers69354 ай бұрын
This really was awesome -- there ought to be a link to it on the official documentation page
@JamesMontemagno3 ай бұрын
Thank you!
@schmidtlach2 ай бұрын
Great idea. I tried to get my design to be similar to this. I came up with several ways, but James gave me a good example of how to do it.🤜🤛👏👏😁
@carlosdelvalle54172 жыл бұрын
I think it is pretty clear 😊. I’ll go refactor my current app right now!
@DanSiegel2 жыл бұрын
So happy to see that you've finally seen the light with interfaces and services... but your MVVMS isn't some fancy new thing, it's just MVVM done exactly as it should be.
@JamesMontemagno2 жыл бұрын
It is, but for anyone getting started I think it is nice to introduce this as a concept as someone new may just put logic right into the VM to call a web service and not think about abstracting it. Not everyone has been doing this stuff for 15 years.
@sebastianbusek20872 жыл бұрын
Sure, you're right James, but it's the same as putting any logic inside the Controller (from MVC). I've been following you and Frank for about two years, and from the beginning, you, I mean you James, always have been against interface segregation. I've supposed you're not Unit testing your "services", but I've never heard that interface segregation makes sense, but you've decided not to use them, because... I'm glad that kind of video finally appears and may enlighten more devs.
@brandon-butler2 жыл бұрын
I agree. Watched the video to see what the 'S' was and realized it's just MVVM :/
@usmcmckee2 жыл бұрын
Great Video James. Looks like I need to update the MVVM Wiki page to say you invited MVVMS 🤣. It's such a simple concept the way you explained it. I am surprised it's not the official standard.
@logank.702 жыл бұрын
I guess I always took the `Model` part of MVVM to just mean "back end." I think for those who have been applying this pattern for long enough and are comfortable in it the "S" part of it just comes naturally (whether if you call it a service, or a manager, or whatever). I've been keeping an eye on Comet and I think the MVU (Model View Update) pattern is really interesting. It would be neat to do a compare/contrast (if you haven't already done one) on those two architectures.
@AlSavant2 жыл бұрын
I came in the comments looking for this reply.
@TuxCommander2 жыл бұрын
Actually this is my approach since I develop WPF applications and it shakes me, when I see VMs with SQL or dbcontext inside.
@Ryan-tg1mx2 жыл бұрын
Hey James, these tutorials are great for the entry into MVVM, but one thing I always wrestle with is scaling up for a more complicated architecture. Say you wanted to have a main page that contains several different components with their own types of data, do you go into nesting view models or do you flatten them into the one main view model? This might be a bad example, but say you split the monkeys app UI in half and have the list on top, and the bottom is a list of regions that filters based on a selection of monkey. I'd store the regions on their own, but when it comes to binding the UI, what's the best practice here? If the main page has its own viewmodel, do you ever bother making viewmodels for the unrelated data or do you only work off models once you get into the initial bound viewmodel? If you split the UI into two views, are you then binding each view to a model or do you wrap them with viewmodels at that point? I've not found a preferred way myself and was curious how others approach this. UI design issues aside, are people generally ok having a lot of model types inside one viewmodel?
@buddysnackit1758 Жыл бұрын
Thanks James. What I really wanted to find "somewhere" was a very straightforward "Create a MVVM skeletal project using WINUI 3." type of tutorial that is recent. Things I don't want to see: 1.) References to other toolkits or the example done in another kit with an explanation just do the WINUI 3 thing instead. 2.) Any explanation as to what MVVM is. 3.) Any explanation as to anything "alternative". I learn about the alternatives later. 4.) Things pre-created or partially started. I want to see all the things you do. 5.) The word Monkey should not be present...nor Snickerdoodle...nor supercalifragilisticexpialidocious (It is distracting.) What I think would be the most useful for me is to just watch you work while doing your very good communication while you are doing it. What would be ideal is to create a super simple application that searches a list of names and returns a phone number. Some of the small stuff trips me up (Because I have one of "those" type of brains.) So how are the filenames created? Do we still have to add them by hand and rename them. What about the folders? So I know you are just wondering who would need this and why. Don't ask. Just create it and we will all praise you. It can be as quick and dirty as you like as long as we see you do all the steps and we can follow along and have a working application. Sorry for being dense or not willing to watch 30 videos from years ago wondering if the content is still applicable. I guess I would just like a fresh starting point set to MVVM and WINUI3.
@petermurton43282 жыл бұрын
I have added a Service to handle the fetching and saving of a PropertyModel collection (From Azure BLOB Storage). This works fine and I thank you for the advice to move to MVVMS. I have a question: I have routines (MoveUp and MoveDown) that can reorder the PropertyCollection, do these belong in the Service?
@johnb25722 жыл бұрын
Nice, very well explained thanks
@OneMassiveMan Жыл бұрын
You’re the best James I watch all your videos
@JamesMontemagno Жыл бұрын
@technics62152 жыл бұрын
James, if the Model works just as data transfer/storage object (you are using kind of POCO class for Monkey) - where should I put my application logic? I usually put it in the Model. I should create services for bussiness/logic layer?
@DTGxliljarhead2 жыл бұрын
Awesome video! Next, could you make a video explaining how to add logic to Xamarin Forms Binded ListView objects. For example, if I am making a bank account app that tracks transactions, how could I make a certain label red if an amount is withdrawn or green if an amount is deposited. Also how could I bind the transaction type to a label that displays an icon based on the transaction type. For example, if the transaction was a web withdrawal show a credit card font icon, if the transaction was a cash withdrawal show a bank font icon, if the transaction was a web deposit show a globe icon, or if the transaction is a cash deposit show a dollar bill icon. I am yet to find a video that will help me accomplish this and I'm sure it will help plenty of other self taught developers like me!
@Moosa_Says2 жыл бұрын
Exact pattern that i use but i always apply an Interface on a service, for testability :)
@Speede04 Жыл бұрын
I would love to see tutorial about opening/creating new window in MVVM architecture. It is pain in the ass, there are so many opinions in the internet for proper way to do it.
@megaman20162 жыл бұрын
I look as mvvm as a front end architecture pattern. Depending on the problem to be solved you can have a SOA or plugin/micro kernel or other layers and architecture patterns underneath.
@RexTorres2 жыл бұрын
This is basically what I have been doing in Android, but instead of "services," I have "repositories," which represent "the single source of truth" and, as with your services, contain the logic for handling data from the internet/database/etc. So, if I were to name the pattern, it would be MVVMR. 😅
@olagisrarikis2 жыл бұрын
One quick question: Does "Visual Studio for ARM 2022" have .NET Maui workload on the roadmap?
@antisnufff8 ай бұрын
I think, nowadays the most struggle is to hande navigation and had a good workflow. I implemented a Controller Class to decouple this. So i have now MVVMSC, eheh
@blackbeans31122 жыл бұрын
Can I apply it in web development?
@OldShoolGames Жыл бұрын
In case of reusable components that we want to use across multiple views, should we use MVVM for that as well ? Should the bigger viewmodels directly reference the viewmodels of these reusable components ?
@chrissmith9725 Жыл бұрын
Really helpful thankyou JM
@JamesMontemagno Жыл бұрын
Glad it helped out
@MrSikesben2 жыл бұрын
Thanks James clear now to me, Is it possible to use code generated by nswag for API as apart of MAUI code base. Thanks once again for the gems
@hastifallah732 жыл бұрын
Hi. It would be so great if you make a video about comparison between flatter and Maui
@TornTech12 жыл бұрын
What are your thoughts about the dependency of the model spanning all the way from deserialisation inside of the service to binding on the view? I get that it makes it easier, your not having to do a mapping exercise. But it just feels like the model should be owned by the view and an identical DTO type model used in the service for deserialisation. What if the json structure was to change? Now your views model is pretty much bound to the backend JSON structure?
@neralem2 жыл бұрын
You showcased the CommunityToolkit preview that offers mvvm with source generators. Can you tell us how to use this with dedicated models?
@dreamdancer82122 жыл бұрын
Thanks for this, as usual, great explanation. But one question puzzles me. Isn´t that architecture in a way an Anemic domain model? Or would you rather say we are not really talking of Domain Models in this case but simple Data structures to pass data around - a bit like a date transfer object. And if your application would need a real business logic - where would you put it? I personally struggle with this question a lot. It would be great to hear your view
@JamesMontemagno2 жыл бұрын
Well if it is processing the data just for the viewmodel i think fine to put it in there, but if hitting external services such as HTTP/DataBase/ETC I would put it not in there. Would probably need an example, but in general... whatever you do an pick is fine ;)
@Adam-ce5mq2 жыл бұрын
I also struggle a bit with what exactly people consider the model to be in MVVM. I'm not sure there's a definitive answer. I generally don't use my domain models as the model and, as James has done here, tend to create POCOs to do the job - certainly in an application of any size and complexity. When using domain models in MVVM I feel I always end up muddying their clarity and purpose by introducing concerns that feel primarily, if not exclusively, related to the UI.
@spaprune2 жыл бұрын
Thanks! Your videos are helping this 38+ year coder get up to speed with this latest YAF (yet another framework). Do you have recommendations for authentication and managing session state? In a “roll your own” Auth scheme, which is more likely in private enterprise line-of-business apps, I was thinking of simply setting that up as just another set of classes through mvvms. I see 3rd party services (like auth0) but I can’t see how I’d reconcile that with an internally managed authorized user list, and the services don’t seem to address session state management.
@maheshkumbhar42162 жыл бұрын
Hi @James, What is future of Xamarin UiTest with MAUI ????
@zarokoshin40902 жыл бұрын
Great Video !! It would be cool if you make a video about Content Provider to share SQLite database across apps (locally)…
@btigenie2 жыл бұрын
Another awesome video! Not just for the content but because of the way you explain and how logical everything is. Your videos should be a staple in every CS Curriculum in college! Question. I usually put all my EF database "stuff" in a separate project and reference it in my main app. I also usually have a Repository project as well if it will have a lot of custom methods, etc. In your "S" pattern, would you still use the services to call out to the Repository project or start phasing out the Repository and store all that in the Services section?
@JamesMontemagno2 жыл бұрын
I now consider the Repository and Service the same thing. I don't like to add that additional layer on. NO real reason IMHO.
@btigenie2 жыл бұрын
@@JamesMontemagnoUnless you have other layers that might need to access the DB, you put everything in the Service layer?
@Jake-iw3tl2 жыл бұрын
I still remember a time before you looked like hippie Tech Jesus 😄 And how do you not have more subscribers? 😮
@EnriqueThedy2 жыл бұрын
Hello James! from Rosario, Argentina. Thanks for all of your videos, you're a great communicator. I'm "ready" to advance in the future to MAUI and WinUI but for now working in WPF yet. Could you please take a few minutes to explain how to use the hosting facilities of NET into a WPF app? i.e logging, DI, hosted services...etc. I have an idea how I could do it (basically starting from a console project), but surely you could describe it in a more formal way. Thank you ;very much!
@deltaphilip86112 жыл бұрын
The view is the xaml with no code behind or little? Who is the navigation boss? The view, or the view model? I am leaning blazor, is MVVMS applicable?
@laurolnunes2 жыл бұрын
Hello James! =) Could you explain about OnPropertyChanged in BindableObjects? I'm trying to bind three properties in cascade, but when I call the first OnPropertyChanged of this cascade, it passes twice and assigns null to the last property. Do you know why this is happening?
@jagadishwarballa2 жыл бұрын
I see errors in 2 way binding in MAUI. One I reported to Microsoft. I see couple of more. Data binding is working only for the current page. If we make changes in detail page and comeback to previous page , we will still see the old details in main page.
@elemiliio45822 жыл бұрын
Hey James. Really nice video, just caught up on MAUI recently, had been working on WPF for a while. I think we share a very very similar opinion on how MVVM should work. I have a question for you! In your opinion, what are the advantages/disadvantages of putting services in an interface? Also do you declare them as singleton in the builder? Thanks man
@moranlg Жыл бұрын
I am not James, But I will try to answer your questions (from my point of view) First question: As usual, you will need to put your service under the interface in the next scenarios: 1. For testing another class that depends on your service - You would like to mock your service in this case 2. Different implementations for the same functionality 3. If you want to reduce the references dlls from your program - Assuming that the service is defined in another dll If you are not planning that, then an interface will not be required. The second question (Service as a singleton) 1. When you need to synchronize (lock) access to a shared resource (for example). 2. When performance is important, the pattern will allow you to create the instance only once. 3. When you want to communicate between view models, an event aggregator is not an option If none of the above is required, I strongly suggest avoiding the singleton pattern for various reasons among them: 1. It "enforces" its lifetime on injected services 2. Assume that you have for example tabs in your application, and the user is currently viewing the first tab. why are the services which are related to the second tab should live at all...
@TaoriUTS2 жыл бұрын
10:13 you are creating a http client. Is HttpClientFactory not a thing in the MAUI sdk? Afaik creating individual http clients instead of recycling them throughout an application per host domain can cause socket exhaustion on the far end.
@cbradbaer2 жыл бұрын
Hi James, thanks for making such a clear and concise video. Side note question: I noticed in your code you are now using [RelayCommmand] instead of [ICommand] from the Toolkit's MVVM helpers. Can you explain the difference? Thanks.
@JamesMontemagno2 жыл бұрын
Yes! In Preview 4 they renamed a few attributes -> github.com/CommunityToolkit/dotnet/releases/tag/v8.0.0-preview4
@marikselazemaj34282 жыл бұрын
Totally agree
@junior.santana2 жыл бұрын
Hey James have you talked about exception handling yet? That could be a nice video
@JamesMontemagno2 жыл бұрын
Will add to list for sure!
@gabrielheming2 жыл бұрын
How about a more complex architecture as Hexagonal? I mean, not removing the MVVMS part, but splitting into projects as well. I am new to MAUI but came with an extensive background in API and major big projects. I often see small projects growing increasingly fast, and the single project or N-tiers solution becomes hard to maintain. Can be that true for MAUI projects, or do they benefit from the rule "smaller = better" (less complex)?
@marcinbalcerzyk842 жыл бұрын
Hi. Does MVVMS makes sense for languages like Python?
@azgan1232 жыл бұрын
Amazing hair! I can't believe you've been hiding it under a hat for so long.
@JamesMontemagno2 жыл бұрын
It comes out on occasions ;)
@mikp12802 жыл бұрын
Love your content! Can you suggest any forum for beginners? I have problems with maui in VS-preview which should be easy to solve. (Example: resolving from bindings in xaml)
@JamesMontemagno2 жыл бұрын
Can checkout Q&A: docs.microsoft.com/en-us/answers/products/dotnet
@c0ward2 жыл бұрын
I'm still curious around the use of the vanilla ObservableCollection - is it really good for performance to fire off an event for each monkey, or better to subclass and send one CollectionChanged once all monkeys are added?
@JamesMontemagno2 жыл бұрын
I personally have an ObservableRangeCollection I use when adding a bunch of items. It is in my mvvm helpers library
@NK-xw4uu2 жыл бұрын
Here is how I use ViewModel concept (which is different to your concept): Say there is User table and a UserAddress table. And there is a User and UserAddress model (entity framework). I will create a view model called vmUserAddress which contains fields from User and address model. Then I will create a service with method GetUserAddress(id) which will query the user and address tables and create a new instance of vmUserAddress and return it My controller will call that service method and the rerurnd vmUserAddress will be passed into the View.
@AdamsTaiwan2 жыл бұрын
I don't get the purpose of the AddSingleton, AddTransient, do you have a video on just these?
@abdalghanialbiek89992 жыл бұрын
Can we use MVI pattern in C# project?? cause my brother told that he made an architecture for his flutter app using MVVM and MVI design patterns
@JamesMontemagno2 жыл бұрын
Take a look at www.reactiveui.net/
@BrianLagunas2 жыл бұрын
You know I love you bro, but that's just plain MVVM 👍
@JamesMontemagno2 жыл бұрын
It is, but for anyone getting started I think it is nice to introduce this as a concept as someone new may just put logic right into the VM to call a web service and not think about abstracting it. Not everyone has been doing this stuff for 15 years.
@BrianLagunas2 жыл бұрын
@@JamesMontemagno definitely. Thanks for taking the time to share and helping point people in the right direction.
@williamliu89852 жыл бұрын
Hi Brian, I haven't seen your update video for a long time, how are you doing?
@BrianLagunas2 жыл бұрын
@@williamliu8985 I’m doing great. Just really busy with my day job. Hoping to get back to videos soon though. Thanks for checking on me!
@williamliu89852 жыл бұрын
@@BrianLagunas Great! Your cool videos inspired me a lot in the WPF/MVVM, thanks a lot!!
@d3hlvi2 жыл бұрын
Thank you for the nice video. I am new to MVVM. Please tell me how do you register services if you make it in a separate class library project.
@JamesMontemagno2 жыл бұрын
Hello Riyaz! Thanks for subscribing and being a member! :) If you just add a reference to that project you can reference that service the same way.
@internetissue45482 жыл бұрын
What if i put Related Views and ViewModels together in a single Folder, rather than having a folder called "Views" and Another one called "ViewModels" what is the idea behind separating two related files in tow different folders Please answer my question
@williamliu89852 жыл бұрын
Thanks for sharing the MVVM experience, James! I have two questions. 1. How do you deside allocating the bussness logic into VM or service? (Roughly, I think the testable logic should go to service and do not put VM in unit tests.) 2. Have you ever exposing a service as get only property in VM (normally the service is injected as readonly filed ), then the View can consume this service directly through ViewModel? I tried it several times, but not sure if there is disadvatange by doing so. Thanks!
@wojciechsura2 жыл бұрын
1. View detects, that user *performed an action*. Viewmodel decides *what should happen*. Service knows *how to do it*. For a long time I was against unit testing viewmodels, but it actually allows you to perform functional tests without live UI, which is faster than UI testing. 2. If you use properly dependency injection, I would simply inject service into view. There's nothing bad about it, but ask yourself twice if you are not trying to short-circuit view to service, because you will end up with business logic inside view and this is bad. View should have access only to those services, which helps it perform its role (presenting data and handling user interaction).
@williamliu89852 жыл бұрын
@@wojciechsura Thank you for replying me in detail, Sura! Here is my thoughts, 1. IMO, ViewModel provides the display source (property) and the action (command) for View, I would like to treat the viewmodel as a facade model, it doesn`t do the actual work, but dispatch the jobs to services. (if there is something related to UI element, we can achieve it through converter or behavior over property). Then I can mainly test the services and the View/ViewModel can get away from unit tests. 2. My intention was not to make all the service injected in property. Sometimes, we just make a property in ViewModel and forwarding this to a services property, just like the Monkeys property in MonkeysViewModel 7:05. How about puting this property into the MonkeyService, make the service as a get-only property instead of readonly filed? Then we can consume the Monkeys through MonkeyService.Monkeys in View? Which just make the ViewModel more clean and no need to test against ViewModel. The idea is making the ViewModel more slim and putting the logic into service as much as possible. For MVVMS, we just test the S part, cool?
@wojciechsura2 жыл бұрын
@@williamliu8985 I gave a lot of thought to the pattern you are proposing (slim ViewModel). However I figured, that it would became something what I call "transparent transceivier", blindly passing data from view to service and the other way around. And this approach leads you to think (more or less consciously), *if it is actually needed at all*. Just look at your proposal of publishing service from viewmodel via property. In such case, why not simply provide the service to the view directly instead of trying to squeeze viewmodel to a minimum size? But then, effectively you will realize, that the service you tried to pass to the view *will actually become your viewmodel* and your viewmodel will become just a annoying layer in between view and service, which you try to squeeze, because in this form it actually (IMO) does next to nothing. Such transparent transceivier is a glue code and the glue code is something MVVM along with bindings tries to eliminate. That's why I decided to push making business decisions into the viewmodel: you may need to test it, true, but then in this approach there is no such "transparent" layer and therefore there is no need to publish services through a viewmodel's property. You may there think of a viewmodel actually as a service, which has very specific role to fulfill (handling business logic for a specific view).
@williamliu89852 жыл бұрын
@@wojciechsura To one of the questions: "why not simply provide the service to the view directly instead of trying to squeeze viewmodel to a minimum size?" Service is capable to provide a INPC property for View to comsume, but for the ICommand part, I think it would be better to utilize the RelayCommand(which relay the command to relevant service) in ViewModel for SRP consideration. Furthermore, providing services in View is hard to consume them or it`ll go though the UI event. If there are some specific property just related to the View which is not that related to the services, these property can still stay in ViewModel. I`m not a native Enlish speaker, but yes, I like the concept "glue" for ViewModel. Don`t put too much into it, keep it simple and slim.What I'm thinking right now is, View is the consumer, ViewModel is the glue, Service is the core. Thanks for discussing this! I would like to see the ideas from yours. Everyone may have different perceptions and understandings of MVVM, some of which are based on the problems encountered in real projects.
@williamliu89852 жыл бұрын
One more thing to clarify out, when I mentioned injecting as property, I was talking about the following code style, the injection was captured as property but not field, as View can consume the service`s property directly without wrapping it again in VM: public class MainViewModel { public IMonkeyService MonkeyService { get; } public MainViewModel(IMonkeyService monkeyService) { MonkeyService = monkeyService; } } but if there is no need to consume the property from the service, the service can also be captured as filed.
@TaughtSimply2 жыл бұрын
Hey! I was wondering if you would be able to do Xamarin WebSockets tutorial? Or direct me to it one?
@nyashamuzeza3696 Жыл бұрын
Thank you ❤🔥
@abdulwasey1151 Жыл бұрын
All good. But I think MonkeyService should implement IMonkeyService, And then we will be able to mock it in our integration tests by using moq. If there is any other way to mock concrete classes.. Please enlighten me with that method. Thanks!
@JamesMontemagno Жыл бұрын
Sure! Interfaces are great :)
@HOWYOUDOIN8843 ай бұрын
Is there code to download? Can't see all of it in video so it's impossible to see what you are talking about. Would be nice if your videos had more diagrams.
@JamesMontemagno3 ай бұрын
Its the workshop code: github.com/dotnet-presentations/dotnet-maui-workshop
@LeutnantJoker Жыл бұрын
It's a good video but I'm confused that you consider this anything new. This service layer in parallel to the main M VM V stack has always existed. That's been a part of the MVVM architecture as long as I can remember. How is this anything new?
@jayveebelano90412 жыл бұрын
can I get a link of codes? thanks in advance!!
@kopilkaiser8991 Жыл бұрын
💯
@FnOTradingLearner Жыл бұрын
Why there is no sample template with MVVM or MVVMS or any pattern with two field of CRUD operation so that anybody can start with say simple crud or master detail crud and modify just model class and other entities and good to go !
@ferccino2 жыл бұрын
MVVMZ Model View ViewModel Zervices
@CikaGrma2 жыл бұрын
Have you used Prism?
@JamesMontemagno2 жыл бұрын
I haven't used it in projects personally, but I have explored it.
@BrianLagunas2 жыл бұрын
As you may know, Prism has been recommending this since 2008. Although this isn't really MVVM specific, it is a good pattern to use in your app development regardless if you are using MVVM or not.
@CaraParker-j7n3 ай бұрын
Anderson Joseph Walker Shirley Young Jason
@zandeecalma48012 жыл бұрын
Oce
@JamesMontemagno2 жыл бұрын
Yup, that is who I worked for :)
@sandromagalli8587 Жыл бұрын
The same thing would be nice in Blazor, but there is not community toolkit for that, why people like to have viewmodels in xamarin/maui used in this way and not in Blazor? You end up writing the logic in the component so you can't really swap framework. ReactiveUI does it anyway so it can work. At the end of the day you can just implement INotifyPropertyChanged and call StateHasChanged on it but it seems like the Blazor team don't really want to support such pattern or am i wrong?
@BenYehudaOfficial2 ай бұрын
Hey bro. I like your videos and I need some help with my project do you have a discord i can contact you directly?