Azure / Commercial-Marketplace-SaaS-Accelerator

A reference example with sample code for developers interested publishing transactable, Software as a-Service offers in the Microsoft commercial marketplace.
MIT License
188 stars 289 forks source link

DTO/Model-ViewModel clean up #377

Open dstarr opened 1 year ago

dstarr commented 1 year ago

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

dstarr commented 1 year ago

Should we use records as view models?

alexdrenea commented 1 year ago

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: