Open dstarr opened 1 year ago
Should we use records as view models?
I am 100% in favor of using records.
I would like to have a bit of a design / architecture design session to evaluate and organize the types of model / DTO / ViewModels we use and identify opportunities to improve separation of concerns while refactoring.
My initial analysis, I identified 4 types or "models" but no clear rules on where to use what:
What I'd like is to come to an agreement and architecture guidance on how and where we use these types of models and answer some of these questions:
What types of objects do repository methods interact with? What about Service Methods?
Who is responsible for ViewModel <-> AppModel <-> DB Entity translation?
Where does validation happen? Etc..
Problem: The Models folder in Services Solution contains a mis-mash of objects representing either Application Models (PlanModel, OffersModel), API Response classes mapped from original DTOs (Subscription Result) and ViewModels. Sometimes there is no clear definition of where goes where.
Solution: Organize and refactor Application Objects to increase clarity of what objects should be used.
Benefits: Developer productivity