Question about DI with ViewModels and CompiledBindings #19357
-
The docs regarding DI shows as an example, using a view model in the DI collection. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Views are directly coupled to a type. Whether that's a concrete VM, base VM, or an interface is up to you. DI doesn't mean you need to abstract absolutely everything and turning everything into an abstraction without a concrete purpose is regarded as more of an antipattern these days. |
Beta Was this translation helpful? Give feedback.
-
Technically, if you strictly follow MVVM it should make no difference. View Models should wrap models and not do any major application logic on their own. Which suits a DI pattern pretty well. |
Beta Was this translation helpful? Give feedback.
Views are directly coupled to a type. Whether that's a concrete VM, base VM, or an interface is up to you. DI doesn't mean you need to abstract absolutely everything and turning everything into an abstraction without a concrete purpose is regarded as more of an antipattern these days.