Tesseraction
Tesseraction
CC#
Created by Tesseraction on 10/14/2023 in #help
MVVN w/ Dependency Injection: Best Practice
This question is for those who have personal experience building applications with the use of an MVVN model in combination with Dependency Injection. Dear People o’ Kindness, I have a class that is responsible for providing utility related to serializing, deserializing, writing and reading to files. At the moment, this class is static, accessible from everywhere in the program, and has an “Initialization” method that is called from the program’s Main method. I am considering making this class non-static and then passing it as a transient service to any ViewModel that requests it. Instead of Initializing it in the program’s Main, it would be automatically “initialized” in its constructor every time it is requested. Should I do this, and should the ViewModels be the receiver of these kinds of services? Thanks, Guy on the internet (:
51 replies