mercredi 29 juillet 2020

How to avoid DTO Models replication Pattern?

C# SOLUTION-1

  • Project-1: CodeFirstEntityFramework (Models are defined within this)
  • Project-2: WebAPIs referenced the CodeFirstEntityFramework Models are available
  • Project-3: Web Application Core Referenced the CodeFirstEntityFramework Model Definitions are available and used Web APIs with Authentication

Is this a good Pattern? OR C# SOLUTION-2

  • Project-1: Class Library ModelsClassLib Define Models Only
  • Project-2: CodeFirstEntityFramework refrence ModelsClassLib
  • Project-3: WebAPIs referenced the CodeFirstEntityFramework
  • Project-4: Web Application Core UI uses the WebAPIs

Wherever Models are needed I will reference ModelsClassLib instead of replicating the Models in place of DTOModel Objects. Question: Is this recommended? Is this a Good Practice?

Aucun commentaire:

Enregistrer un commentaire