SlideShare a Scribd company logo
Website Patterns
Agenda
Core Engineering Principles
• DRY
  – Don’t Repeat Yourself
• SOLID
  – Single Responsibility
  – Open Closed
  – Liskov Substitution
  – Interface Segregation
  – Dependency Inversion
Top 5 Web Debt Causes
• Controllers doing too much
• Domain Model Issues
  – Incomplete
  – Lack of constraints / incorrect cardinality
  – Circular Dependencies
• View Issues
  – Inconsistent use of Domain and View Models
  – View code is doing too much
• Database Generation
• Unnecessary WCF Service Layers
Pattern
Domain Model
• The domain model is pure POCO
• The domain model holds state and no
  behaviour.
• The domain model is the currency for all
  layers of the website from the controller to
  the repositories.
View Model
• The View Model is the state required to be
  bound to a View
• The view model object graph is in a format
  most appropriate for a View
• Validation should occur against the view
  model via Data Annotations.
• View Models are extended with helper
  method to assist the flow of View code.
Controllers
• Controllers should only have dependencies on
  Tasks
• Controllers should be responsible for calling
  the required task actions to get / save the data
  required
• Controllers call mappers to map between
  domain objects and view models
Views
• A view should only be bound to a ViewModel
  object and never expose a domain object
  directly as its model
• Logic required for views should be
  implemented as extension methods of the
  ViewModel and not directly within the view
  itself
Tasks
• A task can be viewed as the business layer for
  a domain aggregate.
• A tasks is where the behaviour for a aggregate
  domain object is implemented
• Tasks deal only with domain objects
• Tasks can make one or more repository calls to
  a Repository for the same domain aggregate.
Repository
• A single repository exists for each domain
  aggregate
• A repository will normally map 1-2-1 with tasks.
• The repository is responsible for transactional
  boundaries and compensation if required.
• A repository does not have to be solely for
  communication with a database but can be used
  for any means of data access such as
  communicating with services
ENTITY FRAMEWORK
REPOSITORIES
Domain Model
• Model First Domain using EF 4.1
  – Auto Generated POCO Entities
  – Visualisation of object relationships
  – Build time validation
• Database Generation done in SQL Scripts
Entity Framework Repositories
• Encapsulates DbContext use
• Use Commands to Encapsulate LINQ to
  Entities queries
• Object Disposal handled via Using declarations
Entity Framework Commands
• The command class is a single location where
  all commands against a database context are
  encapsulated.
• Promotes LINQ reuse across all repositories
• Centralised location of all database use of
  IQueryable
• Decorated with multiple interfaces to restrict
  access from repositories.
• Commands are the transaction boundary.

More Related Content

What's hot

Migration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET CoreMigration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET Core
Miroslav Popovic
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application development
Skillwise Group
 
Git preso to valtech cfml team
Git preso to valtech cfml teamGit preso to valtech cfml team
Git preso to valtech cfml team
SaravanaMuthu Jayaraj
 
A User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubA User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHub
Rumyana Rumenova
 
Alfresco WebScript Connector for Apache ManifoldCF
Alfresco WebScript Connector for Apache ManifoldCFAlfresco WebScript Connector for Apache ManifoldCF
Alfresco WebScript Connector for Apache ManifoldCF
Piergiorgio Lucidi
 
asp-net.pptx
asp-net.pptxasp-net.pptx
asp-net.pptx
Fajar Baskoro
 
Service-oriented architecture
Service-oriented architectureService-oriented architecture
Service-oriented architecture
Shalva Usubov
 
Road Trip To Component
Road Trip To ComponentRoad Trip To Component
Road Trip To Component
Marketa Adamova
 
Architecting Single Page Applications
Architecting Single Page ApplicationsArchitecting Single Page Applications
Architecting Single Page Applications
Guy Nesher
 
4 container management
4  container management4  container management
4 container management
Len Bass
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
asim78
 
Java SNMP Oplet
Java SNMP OpletJava SNMP Oplet
Java SNMP Oplet
Tal Lavian Ph.D.
 
Streams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik KnopStreams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik Knop
Perforce
 
SpringPeople Introduction to Mule ESB
SpringPeople Introduction to Mule ESBSpringPeople Introduction to Mule ESB
SpringPeople Introduction to Mule ESB
SpringPeople
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen OxfordPhil Pursglove
 
Improving page migration분산처리
Improving page migration분산처리 Improving page migration분산처리
Improving page migration분산처리
Park Chunduck
 
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
anshkhurana01
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
Alan Hecht
 
Entity Framework Core 2.1: Simple, Powerful Data Access for .NET
Entity Framework Core 2.1: Simple, Powerful Data Access for .NETEntity Framework Core 2.1: Simple, Powerful Data Access for .NET
Entity Framework Core 2.1: Simple, Powerful Data Access for .NET
Microsoft Tech Community
 

What's hot (20)

Migration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET CoreMigration from ASP.NET MVC to ASP.NET Core
Migration from ASP.NET MVC to ASP.NET Core
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application development
 
Git preso to valtech cfml team
Git preso to valtech cfml teamGit preso to valtech cfml team
Git preso to valtech cfml team
 
A User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubA User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHub
 
Alfresco WebScript Connector for Apache ManifoldCF
Alfresco WebScript Connector for Apache ManifoldCFAlfresco WebScript Connector for Apache ManifoldCF
Alfresco WebScript Connector for Apache ManifoldCF
 
asp-net.pptx
asp-net.pptxasp-net.pptx
asp-net.pptx
 
Service-oriented architecture
Service-oriented architectureService-oriented architecture
Service-oriented architecture
 
Road Trip To Component
Road Trip To ComponentRoad Trip To Component
Road Trip To Component
 
Architecting Single Page Applications
Architecting Single Page ApplicationsArchitecting Single Page Applications
Architecting Single Page Applications
 
4 container management
4  container management4  container management
4 container management
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Java SNMP Oplet
Java SNMP OpletJava SNMP Oplet
Java SNMP Oplet
 
Streams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik KnopStreams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik Knop
 
SpringPeople Introduction to Mule ESB
SpringPeople Introduction to Mule ESBSpringPeople Introduction to Mule ESB
SpringPeople Introduction to Mule ESB
 
Velocity - NxtGen Oxford
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen Oxford
 
Improving page migration분산처리
Improving page migration분산처리 Improving page migration분산처리
Improving page migration분산처리
 
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
 
FatDB Intro
FatDB IntroFatDB Intro
FatDB Intro
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
 
Entity Framework Core 2.1: Simple, Powerful Data Access for .NET
Entity Framework Core 2.1: Simple, Powerful Data Access for .NETEntity Framework Core 2.1: Simple, Powerful Data Access for .NET
Entity Framework Core 2.1: Simple, Powerful Data Access for .NET
 

Viewers also liked

Model View Command Pattern
Model View Command PatternModel View Command Pattern
Model View Command PatternAkash Kava
 
Opportunity Plan Presentation - Philippines
Opportunity Plan Presentation - PhilippinesOpportunity Plan Presentation - Philippines
Opportunity Plan Presentation - PhilippinesJhun Paran
 
Competencia liderazgo
Competencia liderazgoCompetencia liderazgo
Competencia liderazgoTito Perez
 
Practica de laboratorio el microscopio
Practica de laboratorio el microscopioPractica de laboratorio el microscopio
Practica de laboratorio el microscopio
joshman valarezo
 
Why Your Public Company Doesn't Need Capital Markets Visibility 365
Why Your Public Company Doesn't Need Capital Markets Visibility 365Why Your Public Company Doesn't Need Capital Markets Visibility 365
Why Your Public Company Doesn't Need Capital Markets Visibility 365
IR Smartt Inc.
 
Masalah yang Dihadapi Ketika Membuat Kek
Masalah yang Dihadapi Ketika Membuat KekMasalah yang Dihadapi Ketika Membuat Kek
Masalah yang Dihadapi Ketika Membuat KekCik Kyra
 
Analytical thinking 12 - August 2012
Analytical thinking 12 - August 2012Analytical thinking 12 - August 2012
Analytical thinking 12 - August 2012
Charlotte Skornik
 
โกลเด้น รีทรีฟเวอร์
โกลเด้น รีทรีฟเวอร์โกลเด้น รีทรีฟเวอร์
โกลเด้น รีทรีฟเวอร์PongsaTorn Sri
 
Actualog presentation for mrsk
Actualog presentation for mrskActualog presentation for mrsk
Actualog presentation for mrskActualog
 
Vintage music rien Zubaedah
Vintage music rien ZubaedahVintage music rien Zubaedah
Actialog in pictures
Actialog in picturesActialog in pictures
Actialog in pictures
Actualog
 
Blog pp cultural diversity
Blog pp cultural diversityBlog pp cultural diversity
Blog pp cultural diversityPaulineHeadley
 
2012 SEO For Press Releases
2012 SEO For Press Releases2012 SEO For Press Releases
2012 SEO For Press Releases
IR Smartt Inc.
 
東京ソーシャルデザイン研究所3ドラフト
東京ソーシャルデザイン研究所3ドラフト東京ソーシャルデザイン研究所3ドラフト
東京ソーシャルデザイン研究所3ドラフトTakayuki Toda
 
Simon says stand out
Simon says stand outSimon says stand out
Simon says stand out
Simon Hurry
 
WepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als dasWepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als dasenpit GmbH & Co. KG
 
Poverty group c3
Poverty group c3Poverty group c3
Poverty group c3Bernard Sng
 

Viewers also liked (20)

Model View Command Pattern
Model View Command PatternModel View Command Pattern
Model View Command Pattern
 
Opportunity Plan Presentation - Philippines
Opportunity Plan Presentation - PhilippinesOpportunity Plan Presentation - Philippines
Opportunity Plan Presentation - Philippines
 
Competencia liderazgo
Competencia liderazgoCompetencia liderazgo
Competencia liderazgo
 
Practica de laboratorio el microscopio
Practica de laboratorio el microscopioPractica de laboratorio el microscopio
Practica de laboratorio el microscopio
 
Why Your Public Company Doesn't Need Capital Markets Visibility 365
Why Your Public Company Doesn't Need Capital Markets Visibility 365Why Your Public Company Doesn't Need Capital Markets Visibility 365
Why Your Public Company Doesn't Need Capital Markets Visibility 365
 
Masalah yang Dihadapi Ketika Membuat Kek
Masalah yang Dihadapi Ketika Membuat KekMasalah yang Dihadapi Ketika Membuat Kek
Masalah yang Dihadapi Ketika Membuat Kek
 
Analytical thinking 12 - August 2012
Analytical thinking 12 - August 2012Analytical thinking 12 - August 2012
Analytical thinking 12 - August 2012
 
Digital Video#1
Digital Video#1Digital Video#1
Digital Video#1
 
โกลเด้น รีทรีฟเวอร์
โกลเด้น รีทรีฟเวอร์โกลเด้น รีทรีฟเวอร์
โกลเด้น รีทรีฟเวอร์
 
Actualog presentation for mrsk
Actualog presentation for mrskActualog presentation for mrsk
Actualog presentation for mrsk
 
Vintage music rien Zubaedah
Vintage music rien ZubaedahVintage music rien Zubaedah
Vintage music rien Zubaedah
 
Actialog in pictures
Actialog in picturesActialog in pictures
Actialog in pictures
 
Blog pp cultural diversity
Blog pp cultural diversityBlog pp cultural diversity
Blog pp cultural diversity
 
Humble sparrow
Humble sparrowHumble sparrow
Humble sparrow
 
Article08
Article08Article08
Article08
 
2012 SEO For Press Releases
2012 SEO For Press Releases2012 SEO For Press Releases
2012 SEO For Press Releases
 
東京ソーシャルデザイン研究所3ドラフト
東京ソーシャルデザイン研究所3ドラフト東京ソーシャルデザイン研究所3ドラフト
東京ソーシャルデザイン研究所3ドラフト
 
Simon says stand out
Simon says stand outSimon says stand out
Simon says stand out
 
WepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als dasWepApps mit Play! - Nichts leichter als das
WepApps mit Play! - Nichts leichter als das
 
Poverty group c3
Poverty group c3Poverty group c3
Poverty group c3
 

Similar to MVC Website Pattern The Controller, Task, Repository, Command Pattern

Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
Steve Barbour
 
Entity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and Beyond
Steve Westgarth
 
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Domain Driven Design Ruby Ways -  JURNAL 05/10/2017Domain Driven Design Ruby Ways -  JURNAL 05/10/2017
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Jonathan Wylliem
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
Fajar Baskoro
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patterns
Rahul Singh
 
Java Spring
Java SpringJava Spring
Java Spring
AathikaJava
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
Inocentshuja Ahmad
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency Injection
Shane Church
 
Code igniter overview
Code igniter overviewCode igniter overview
Code igniter overview
umesh patil
 
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
chaturanga ranatunga
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
Allan Mangune
 
Ruby on Rails & Version Control
Ruby on Rails & Version ControlRuby on Rails & Version Control
Ruby on Rails & Version Control
Yash Mittal
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
iMOBDEV Technologies Pvt. Ltd.
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
Gaurav Singh
 
Hybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbaiHybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbai
Vibrant Technologies & Computers
 
DevOps+Data: Working with Source Control
DevOps+Data: Working with Source ControlDevOps+Data: Working with Source Control
DevOps+Data: Working with Source Control
Ed Leighton-Dick
 
A Note on Distributed Computing - Papers We Love Hyderabad
A Note on Distributed Computing - Papers We Love HyderabadA Note on Distributed Computing - Papers We Love Hyderabad
A Note on Distributed Computing - Papers We Love Hyderabad
Hrishikesh Barua
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
Srinivasan Nanduri
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Wen-Tien Chang
 

Similar to MVC Website Pattern The Controller, Task, Repository, Command Pattern (20)

Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
 
Entity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and Beyond
 
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Domain Driven Design Ruby Ways -  JURNAL 05/10/2017Domain Driven Design Ruby Ways -  JURNAL 05/10/2017
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patterns
 
Java Spring
Java SpringJava Spring
Java Spring
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency Injection
 
Code igniter overview
Code igniter overviewCode igniter overview
Code igniter overview
 
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
How to Structure Your Xamarin Solution by Adhering to Common .NET Practices -...
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
Ruby on Rails & Version Control
Ruby on Rails & Version ControlRuby on Rails & Version Control
Ruby on Rails & Version Control
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
 
Hybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbaiHybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbai
 
DevOps+Data: Working with Source Control
DevOps+Data: Working with Source ControlDevOps+Data: Working with Source Control
DevOps+Data: Working with Source Control
 
A Note on Distributed Computing - Papers We Love Hyderabad
A Note on Distributed Computing - Papers We Love HyderabadA Note on Distributed Computing - Papers We Love Hyderabad
A Note on Distributed Computing - Papers We Love Hyderabad
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 

Recently uploaded

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

MVC Website Pattern The Controller, Task, Repository, Command Pattern

  • 3. Core Engineering Principles • DRY – Don’t Repeat Yourself • SOLID – Single Responsibility – Open Closed – Liskov Substitution – Interface Segregation – Dependency Inversion
  • 4. Top 5 Web Debt Causes • Controllers doing too much • Domain Model Issues – Incomplete – Lack of constraints / incorrect cardinality – Circular Dependencies • View Issues – Inconsistent use of Domain and View Models – View code is doing too much • Database Generation • Unnecessary WCF Service Layers
  • 6. Domain Model • The domain model is pure POCO • The domain model holds state and no behaviour. • The domain model is the currency for all layers of the website from the controller to the repositories.
  • 7. View Model • The View Model is the state required to be bound to a View • The view model object graph is in a format most appropriate for a View • Validation should occur against the view model via Data Annotations. • View Models are extended with helper method to assist the flow of View code.
  • 8. Controllers • Controllers should only have dependencies on Tasks • Controllers should be responsible for calling the required task actions to get / save the data required • Controllers call mappers to map between domain objects and view models
  • 9. Views • A view should only be bound to a ViewModel object and never expose a domain object directly as its model • Logic required for views should be implemented as extension methods of the ViewModel and not directly within the view itself
  • 10. Tasks • A task can be viewed as the business layer for a domain aggregate. • A tasks is where the behaviour for a aggregate domain object is implemented • Tasks deal only with domain objects • Tasks can make one or more repository calls to a Repository for the same domain aggregate.
  • 11. Repository • A single repository exists for each domain aggregate • A repository will normally map 1-2-1 with tasks. • The repository is responsible for transactional boundaries and compensation if required. • A repository does not have to be solely for communication with a database but can be used for any means of data access such as communicating with services
  • 13. Domain Model • Model First Domain using EF 4.1 – Auto Generated POCO Entities – Visualisation of object relationships – Build time validation • Database Generation done in SQL Scripts
  • 14. Entity Framework Repositories • Encapsulates DbContext use • Use Commands to Encapsulate LINQ to Entities queries • Object Disposal handled via Using declarations
  • 15. Entity Framework Commands • The command class is a single location where all commands against a database context are encapsulated. • Promotes LINQ reuse across all repositories • Centralised location of all database use of IQueryable • Decorated with multiple interfaces to restrict access from repositories. • Commands are the transaction boundary.