SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Elements of DDD with
      ASP .NET MVC &
Entity Framework Code First
                        Gabriel ENEA, Technical Director
                                           MAXCODE.nl
Co-founder Joobs.ro – the first IT job portal in Romania
                              CodeCamp member / Iași
            gabriel.enea@maxcode.ro / gabrielenea.blogspot.com / @dotnet18




 Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
IT Camp 2011
• Thanks for coming!
• ITCamp is made possible by our sponsors:




      Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Agenda
# Unit Testing challenges
# Today Architectural Design
# New approach: Domain-Driven-Design
# Today’s Tools (@web)
# Demo

• Q&A

     Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Application requirements

DEMO


       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
UNIT TESTING CHALLENGES


   Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
How do you test it?




Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Testing on components




Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
How do you start building an
       application architecture?
Focus on?
• building an architecture from scratch
• thinking about how to achieve unit testing
• start with modeling the database schema and data relations
• using drag & drop programming
• modeling the domain entities, relations, business rules
• reusing existing code?



• but, in the end, do you achieve 99,99% test code coverage?

         Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Is unit testing achievable? 100%?
Yes or No? Who knows?

Maybe not! Possible answers:
• The customer doesn't understand this need
• Neither the management staff
• Instead, everyone expects you to write the perfect code

• As developers, every time we say: we need time to do it
  right!

• But, do we need time or we don't know how to achieve it?

        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
TODAY ARCHITECTURAL DESIGN


   Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Let's start thinking to architecture
                design
 What? Right, now!?

 Hey, we have only 1 hour to finish this
 presentation! 



 Indeed, but let's try to do something!



     Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
What stops 100% unit testing?
1. Layers
  – How do we design them?
2. Business rules
  – Where and how do we implement?
3. Persistence
  – Should we use an ORM?

  …



       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
1 - Layers

                         Presentation


                              Business


                          Data Access

Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
1 - Layers – any problems?
                                                                       Presentation


                                                                         Business


Layers Coupling!                                                       Data Access


A strong coupling conducts to a hard way to do:
   – unit testing
   – refactoring
   – agile development
   – or be opened for changes


       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
2 - Business rules
Where should these be located?
  – Database
  – Business layer
  – User Interface (aka code behind!)


How do we test them?
  – Running the application
  – Automatically, maybe using unit tests
  – Or we should let the customer test them!? 


      Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
And...what's inappropriate here?
// somewhere in the business layer
public class Patient {
   public DateTime Birthdate { get; set; }

      public int Age { // computed value
        get {
           return DateTime.Now.Year - this.Birthdate.Year;
        }
                  Strong coupling!
      }

      public bool IsAdult { // business rule
        get {
           return this.Age >= 18;
        }
      }
...

               Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
3 - Persistence
Requirements
• Persistence Ignorance / POCO
• Help Domain Model stay out of
  infrastructure stuff
• Decide where to store data (NoSQL?)
• Use code generation or an Object Relation
  (O/R) Mapper
  – Metadata mapping
• Support for the Unit of Work pattern

      Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
NEW APPROACH: DDD


  Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Let's start with a new approach...
Domain-Driven-Design
• What is Domain?

A new default architecture where:
• the database is not the first focus
• the layers are loosely coupled
• the business rules are within the application Domain
• it is easier to achieve unit testing

• Why? Today we have the tools!

        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
A new default architecture - DDD




   Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Building blocks of DDD




Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
TODAY'S TOOLS


   Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Today's tools
(from a web developer perspective)
Dependency Injection frameworks
  – Manage dependencies
  – Castle Windsor, StructureMap, Spring.NET, Unity, ...
ASP.NET MVC 3
  – a mature web development platform based on MVC
    pattern
Entity Framework 4.1 Code First / NHibernate
  – helps you focus on your domain




       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
What is Dependency Injection?
• = DI.Equals(IoC); // true or false?

• IoC = Inversion of Control
• DI = Dependency Injection

• Helps you to decouple the application dependencies
   – Logging mechanisms (log4net, Enterprise Library Logging
     Application Block, ...)
   – Persistence mechanism (direct access to database, ORM)
   – User Interface dependencies on Domain services
   – Layers


        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Dependency Injection


                                                         Log4netLogger


PatientService



                                                        PatientRepositoy




  Premium conference on Microsoft’s Dev and ITPro technologies     @itcampro / #itcampro
Dependency Injection
                                       1) creates
           Builder                                                PatientService




                                     Log4netLogger
2) inject dependencies                                                               3) uses




                                          ILogger



             Premium conference on Microsoft’s Dev and ITPro technologies     @itcampro / #itcampro
ASP.NET MVC 3 and DI support
• Based on MVC pattern
• Provides better support for IoC
   – Views/Controllers
• Model Validation support

• Check IDependencyResolver interface
   – simplify service location and dependency resolution


TService GetService<TService>() { … }

IEnumerable<TService> GetServices<TService>() { … }


        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Persistance with EF 4.1 CodeFirst


1st version benefits:
• CodeFirst development
• Better POCO support
• Mapping based on predefined conventions
   (Convention over configuration)
• Fluent API for manual mapping entities to tables, no
   more .edmx files
• Built-in Model-Level Validation
• Dynamic database creation and dropping

        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
DDD architecture with ASP.NET MVC 3, Unity, Entity Framework
CodeFirst 4.1

DEMO


       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Conclusions
Focus on
  –   Analyze application dependencies
  –   Business rules
  –   Do refactoring!
  –   Design your Domain
  –   Don’t forget to do Unit testing




        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Resources
Books
• Domain-Driven Design, Tackling Complexity in the
  Heart of Software, by Eric Evans
• Applying Domain-Driven Design and Patterns, With
  Examples in C# and .NET, by Jimmy Nilsson

Online resources
• http://domaindrivendesign.org/
• http://www.infoq.com/minibooks/domai
  n-driven-design-quickly

       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Elements of DDD with ASP.NET MVC & Entity Framework Code First

Q&A


       Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro
Don’t forget!
Get your free Azure pass!                            We want your feedback!

• 30+15 days, no CC req’d                        • Win a WP7 smartphone
   – http://bit.ly/ITCAMP11                             – Fill in your feedback forms
   – Promo code: ITCAMP11                               – Raffle: end of the day




        Premium conference on Microsoft’s Dev and ITPro technologies   @itcampro / #itcampro

Weitere ähnliche Inhalte

Was ist angesagt?

Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHPSteve Rhoades
 
Microsoft for developers open source and cross platform
Microsoft for developers  open source and cross platformMicrosoft for developers  open source and cross platform
Microsoft for developers open source and cross platformJulie Lerman
 
Next18 Extended Targu Mures - Bringing the Cloud to you
Next18 Extended Targu Mures - Bringing the Cloud to youNext18 Extended Targu Mures - Bringing the Cloud to you
Next18 Extended Targu Mures - Bringing the Cloud to youMárton Kodok
 
Google Vertex AI
Google Vertex AIGoogle Vertex AI
Google Vertex AIVikasBisoi
 
Domain Driven Design for Angular
Domain Driven Design for AngularDomain Driven Design for Angular
Domain Driven Design for AngularJennifer Estrada
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ..."Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...Fwdays
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Hexagonal architecture message-oriented software design
Hexagonal architecture   message-oriented software designHexagonal architecture   message-oriented software design
Hexagonal architecture message-oriented software designMatthias Noback
 
Arquitectura hexagonal
Arquitectura hexagonalArquitectura hexagonal
Arquitectura hexagonal540deg
 
PL SQLDay Machine Learning- Hands on ML.NET.pptx
PL SQLDay Machine Learning- Hands on ML.NET.pptxPL SQLDay Machine Learning- Hands on ML.NET.pptx
PL SQLDay Machine Learning- Hands on ML.NET.pptxLuis Beltran
 
What's new for Developers in Visual Studio 2013
What's new for Developers in Visual Studio 2013What's new for Developers in Visual Studio 2013
What's new for Developers in Visual Studio 2013Microsoft Visual Studio
 
AppliFire Blue Print Design Guidelines
AppliFire Blue Print Design GuidelinesAppliFire Blue Print Design Guidelines
AppliFire Blue Print Design GuidelinesAppliFire Platform
 
Api chaining(tm)
Api chaining(tm)Api chaining(tm)
Api chaining(tm)Owen Rubel
 
Hexagonal architecture - message-oriented software design (Symfony Live Berli...
Hexagonal architecture - message-oriented software design (Symfony Live Berli...Hexagonal architecture - message-oriented software design (Symfony Live Berli...
Hexagonal architecture - message-oriented software design (Symfony Live Berli...Matthias Noback
 

Was ist angesagt? (20)

Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
 
Microsoft for developers open source and cross platform
Microsoft for developers  open source and cross platformMicrosoft for developers  open source and cross platform
Microsoft for developers open source and cross platform
 
Next18 Extended Targu Mures - Bringing the Cloud to you
Next18 Extended Targu Mures - Bringing the Cloud to youNext18 Extended Targu Mures - Bringing the Cloud to you
Next18 Extended Targu Mures - Bringing the Cloud to you
 
PHP Framework Battle
PHP Framework BattlePHP Framework Battle
PHP Framework Battle
 
Google Vertex AI
Google Vertex AIGoogle Vertex AI
Google Vertex AI
 
Domain Driven Design for Angular
Domain Driven Design for AngularDomain Driven Design for Angular
Domain Driven Design for Angular
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Azure IoT Central
Azure IoT CentralAzure IoT Central
Azure IoT Central
 
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ..."Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...
"Secure Mobile Apps with the Microsoft Identity Platform", Christos Matskas, ...
 
Introduction to-ddd
Introduction to-dddIntroduction to-ddd
Introduction to-ddd
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Hexagonal architecture message-oriented software design
Hexagonal architecture   message-oriented software designHexagonal architecture   message-oriented software design
Hexagonal architecture message-oriented software design
 
Arquitectura hexagonal
Arquitectura hexagonalArquitectura hexagonal
Arquitectura hexagonal
 
PL SQLDay Machine Learning- Hands on ML.NET.pptx
PL SQLDay Machine Learning- Hands on ML.NET.pptxPL SQLDay Machine Learning- Hands on ML.NET.pptx
PL SQLDay Machine Learning- Hands on ML.NET.pptx
 
What's new for Developers in Visual Studio 2013
What's new for Developers in Visual Studio 2013What's new for Developers in Visual Studio 2013
What's new for Developers in Visual Studio 2013
 
Dynamic Apex Binding
Dynamic Apex BindingDynamic Apex Binding
Dynamic Apex Binding
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
AppliFire Blue Print Design Guidelines
AppliFire Blue Print Design GuidelinesAppliFire Blue Print Design Guidelines
AppliFire Blue Print Design Guidelines
 
Api chaining(tm)
Api chaining(tm)Api chaining(tm)
Api chaining(tm)
 
Hexagonal architecture - message-oriented software design (Symfony Live Berli...
Hexagonal architecture - message-oriented software design (Symfony Live Berli...Hexagonal architecture - message-oriented software design (Symfony Live Berli...
Hexagonal architecture - message-oriented software design (Symfony Live Berli...
 

Andere mochten auch

Dan Solovay - Test Driven Sitecore - SUGCON
Dan Solovay - Test Driven Sitecore - SUGCONDan Solovay - Test Driven Sitecore - SUGCON
Dan Solovay - Test Driven Sitecore - SUGCONSUGCON
 
OpenTravel XML Object Suite Mechanics
OpenTravel XML Object Suite MechanicsOpenTravel XML Object Suite Mechanics
OpenTravel XML Object Suite MechanicsOpenTravel Alliance
 
Advanced unit testing – real life examples and mistakes
Advanced unit testing – real life examples and mistakesAdvanced unit testing – real life examples and mistakes
Advanced unit testing – real life examples and mistakesMilan Vukoje
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Bishoy Demian
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignJulie Lerman
 

Andere mochten auch (7)

Dan Solovay - Test Driven Sitecore - SUGCON
Dan Solovay - Test Driven Sitecore - SUGCONDan Solovay - Test Driven Sitecore - SUGCON
Dan Solovay - Test Driven Sitecore - SUGCON
 
Agile Testing - Challenges
Agile Testing - ChallengesAgile Testing - Challenges
Agile Testing - Challenges
 
OpenTravel XML Object Suite Mechanics
OpenTravel XML Object Suite MechanicsOpenTravel XML Object Suite Mechanics
OpenTravel XML Object Suite Mechanics
 
Advanced unit testing – real life examples and mistakes
Advanced unit testing – real life examples and mistakesAdvanced unit testing – real life examples and mistakes
Advanced unit testing – real life examples and mistakes
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven Design
 

Ähnlich wie Elements of DDD with ASP.NET MVC & Entity Framework Code First v2

Mihai Tataran - Building Windows 8 Applications with HTML5 and JS
Mihai Tataran - Building Windows 8 Applications with HTML5 and JSMihai Tataran - Building Windows 8 Applications with HTML5 and JS
Mihai Tataran - Building Windows 8 Applications with HTML5 and JSITCamp
 
ITCamp 2011 - Mihai Tataran, Tudor Damian - Keynote
ITCamp 2011 - Mihai Tataran, Tudor Damian - KeynoteITCamp 2011 - Mihai Tataran, Tudor Damian - Keynote
ITCamp 2011 - Mihai Tataran, Tudor Damian - KeynoteITCamp
 
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows Administrators
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows AdministratorsITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows Administrators
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows AdministratorsITCamp
 
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...ITCamp
 
ITCamp 2011 - Melania Danciu - Mobile apps
ITCamp 2011 - Melania Danciu - Mobile appsITCamp 2011 - Melania Danciu - Mobile apps
ITCamp 2011 - Melania Danciu - Mobile appsITCamp
 
Developing SharePoint 2010 and Silverlight web parts
Developing SharePoint 2010 and Silverlight web partsDeveloping SharePoint 2010 and Silverlight web parts
Developing SharePoint 2010 and Silverlight web partsOvidiu Becheş-Puia
 
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5ITCamp
 
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...ITCamp
 
ITCamp 2011 - Stephen Forte - Kanban
ITCamp 2011 - Stephen Forte - KanbanITCamp 2011 - Stephen Forte - Kanban
ITCamp 2011 - Stephen Forte - KanbanITCamp
 
ITCamp 2011 - Mihai Tataran - Migrating to Azure
ITCamp 2011 - Mihai Tataran - Migrating to AzureITCamp 2011 - Mihai Tataran - Migrating to Azure
ITCamp 2011 - Mihai Tataran - Migrating to AzureITCamp
 
ITCamp 2011 - Mihai Nadas - Windows Azure interop
ITCamp 2011 - Mihai Nadas - Windows Azure interopITCamp 2011 - Mihai Nadas - Windows Azure interop
ITCamp 2011 - Mihai Nadas - Windows Azure interopITCamp
 
Patterns for Scalability in Windows Azure Applications (Alex Mang)
Patterns for Scalability in Windows Azure Applications (Alex Mang)Patterns for Scalability in Windows Azure Applications (Alex Mang)
Patterns for Scalability in Windows Azure Applications (Alex Mang)ITCamp
 
ITCamp 2013 - Petru Jucovschi - Application ecosystems
ITCamp 2013 - Petru Jucovschi - Application ecosystemsITCamp 2013 - Petru Jucovschi - Application ecosystems
ITCamp 2013 - Petru Jucovschi - Application ecosystemsITCamp
 
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitchITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitchITCamp
 
ITCamp 2012 - Paula Januszkiewicz - Stronghold to Strengthen
ITCamp 2012 - Paula Januszkiewicz - Stronghold to StrengthenITCamp 2012 - Paula Januszkiewicz - Stronghold to Strengthen
ITCamp 2012 - Paula Januszkiewicz - Stronghold to StrengthenITCamp
 
How # (sharp) is Your Katana (Ciprian Jichici)
How # (sharp) is Your Katana (Ciprian Jichici)How # (sharp) is Your Katana (Ciprian Jichici)
How # (sharp) is Your Katana (Ciprian Jichici)ITCamp
 
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...ITCamp
 
Vunvulea radu it camp-ro 2012 - building metro style applications on window...
Vunvulea radu   it camp-ro 2012 - building metro style applications on window...Vunvulea radu   it camp-ro 2012 - building metro style applications on window...
Vunvulea radu it camp-ro 2012 - building metro style applications on window...Radu Vunvulea
 
Azure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex MangAzure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex MangITCamp
 
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud StoryITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud StoryITCamp
 

Ähnlich wie Elements of DDD with ASP.NET MVC & Entity Framework Code First v2 (20)

Mihai Tataran - Building Windows 8 Applications with HTML5 and JS
Mihai Tataran - Building Windows 8 Applications with HTML5 and JSMihai Tataran - Building Windows 8 Applications with HTML5 and JS
Mihai Tataran - Building Windows 8 Applications with HTML5 and JS
 
ITCamp 2011 - Mihai Tataran, Tudor Damian - Keynote
ITCamp 2011 - Mihai Tataran, Tudor Damian - KeynoteITCamp 2011 - Mihai Tataran, Tudor Damian - Keynote
ITCamp 2011 - Mihai Tataran, Tudor Damian - Keynote
 
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows Administrators
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows AdministratorsITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows Administrators
ITCamp 2011 - Paula Januszkiewicz - 10 deadly sins of Windows Administrators
 
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
 
ITCamp 2011 - Melania Danciu - Mobile apps
ITCamp 2011 - Melania Danciu - Mobile appsITCamp 2011 - Melania Danciu - Mobile apps
ITCamp 2011 - Melania Danciu - Mobile apps
 
Developing SharePoint 2010 and Silverlight web parts
Developing SharePoint 2010 and Silverlight web partsDeveloping SharePoint 2010 and Silverlight web parts
Developing SharePoint 2010 and Silverlight web parts
 
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
 
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...
ITCamp 2012 - Ovidiu Beches - Developing SharePoint 2010 and Silverlight web ...
 
ITCamp 2011 - Stephen Forte - Kanban
ITCamp 2011 - Stephen Forte - KanbanITCamp 2011 - Stephen Forte - Kanban
ITCamp 2011 - Stephen Forte - Kanban
 
ITCamp 2011 - Mihai Tataran - Migrating to Azure
ITCamp 2011 - Mihai Tataran - Migrating to AzureITCamp 2011 - Mihai Tataran - Migrating to Azure
ITCamp 2011 - Mihai Tataran - Migrating to Azure
 
ITCamp 2011 - Mihai Nadas - Windows Azure interop
ITCamp 2011 - Mihai Nadas - Windows Azure interopITCamp 2011 - Mihai Nadas - Windows Azure interop
ITCamp 2011 - Mihai Nadas - Windows Azure interop
 
Patterns for Scalability in Windows Azure Applications (Alex Mang)
Patterns for Scalability in Windows Azure Applications (Alex Mang)Patterns for Scalability in Windows Azure Applications (Alex Mang)
Patterns for Scalability in Windows Azure Applications (Alex Mang)
 
ITCamp 2013 - Petru Jucovschi - Application ecosystems
ITCamp 2013 - Petru Jucovschi - Application ecosystemsITCamp 2013 - Petru Jucovschi - Application ecosystems
ITCamp 2013 - Petru Jucovschi - Application ecosystems
 
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitchITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
 
ITCamp 2012 - Paula Januszkiewicz - Stronghold to Strengthen
ITCamp 2012 - Paula Januszkiewicz - Stronghold to StrengthenITCamp 2012 - Paula Januszkiewicz - Stronghold to Strengthen
ITCamp 2012 - Paula Januszkiewicz - Stronghold to Strengthen
 
How # (sharp) is Your Katana (Ciprian Jichici)
How # (sharp) is Your Katana (Ciprian Jichici)How # (sharp) is Your Katana (Ciprian Jichici)
How # (sharp) is Your Katana (Ciprian Jichici)
 
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
ITCamp 2012 - Radu Vunvulea - Building metro style applications on Windows 8 ...
 
Vunvulea radu it camp-ro 2012 - building metro style applications on window...
Vunvulea radu   it camp-ro 2012 - building metro style applications on window...Vunvulea radu   it camp-ro 2012 - building metro style applications on window...
Vunvulea radu it camp-ro 2012 - building metro style applications on window...
 
Azure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex MangAzure SQL Database From A Developer's Perspective - Alex Mang
Azure SQL Database From A Developer's Perspective - Alex Mang
 
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud StoryITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
 

Mehr von Enea Gabriel

Moving forward with ASP.NET Core
Moving forward with ASP.NET CoreMoving forward with ASP.NET Core
Moving forward with ASP.NET CoreEnea Gabriel
 
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014Enea Gabriel
 
Improving the availability of your website
Improving the availability of your websiteImproving the availability of your website
Improving the availability of your websiteEnea Gabriel
 
Noutăţi în ASP.NET MVC 2
Noutăţi în ASP.NET MVC 2Noutăţi în ASP.NET MVC 2
Noutăţi în ASP.NET MVC 2Enea Gabriel
 
Introducere în ASP.NET MVC prin exemple
Introducere în ASP.NET MVC prin exempleIntroducere în ASP.NET MVC prin exemple
Introducere în ASP.NET MVC prin exempleEnea Gabriel
 
Magia testelor automate cu ASP.NET MVC
Magia testelor automate cu ASP.NET MVCMagia testelor automate cu ASP.NET MVC
Magia testelor automate cu ASP.NET MVCEnea Gabriel
 
Rute cu ASP.NET MVC
Rute cu ASP.NET MVCRute cu ASP.NET MVC
Rute cu ASP.NET MVCEnea Gabriel
 
Model View Controller și ASP.NET MVC + AJAX
Model View Controller și ASP.NET MVC + AJAXModel View Controller și ASP.NET MVC + AJAX
Model View Controller și ASP.NET MVC + AJAXEnea Gabriel
 

Mehr von Enea Gabriel (9)

Moving forward with ASP.NET Core
Moving forward with ASP.NET CoreMoving forward with ASP.NET Core
Moving forward with ASP.NET Core
 
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
 
Improving the availability of your website
Improving the availability of your websiteImproving the availability of your website
Improving the availability of your website
 
Noutăţi în ASP.NET MVC 2
Noutăţi în ASP.NET MVC 2Noutăţi în ASP.NET MVC 2
Noutăţi în ASP.NET MVC 2
 
FII absolvent!
FII absolvent!FII absolvent!
FII absolvent!
 
Introducere în ASP.NET MVC prin exemple
Introducere în ASP.NET MVC prin exempleIntroducere în ASP.NET MVC prin exemple
Introducere în ASP.NET MVC prin exemple
 
Magia testelor automate cu ASP.NET MVC
Magia testelor automate cu ASP.NET MVCMagia testelor automate cu ASP.NET MVC
Magia testelor automate cu ASP.NET MVC
 
Rute cu ASP.NET MVC
Rute cu ASP.NET MVCRute cu ASP.NET MVC
Rute cu ASP.NET MVC
 
Model View Controller și ASP.NET MVC + AJAX
Model View Controller și ASP.NET MVC + AJAXModel View Controller și ASP.NET MVC + AJAX
Model View Controller și ASP.NET MVC + AJAX
 

Kürzlich hochgeladen

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Kürzlich hochgeladen (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Elements of DDD with ASP.NET MVC & Entity Framework Code First v2

  • 1. Elements of DDD with ASP .NET MVC & Entity Framework Code First Gabriel ENEA, Technical Director MAXCODE.nl Co-founder Joobs.ro – the first IT job portal in Romania CodeCamp member / Iași gabriel.enea@maxcode.ro / gabrielenea.blogspot.com / @dotnet18 Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 2. IT Camp 2011 • Thanks for coming! • ITCamp is made possible by our sponsors: Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 3. Agenda # Unit Testing challenges # Today Architectural Design # New approach: Domain-Driven-Design # Today’s Tools (@web) # Demo • Q&A Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 4. Application requirements DEMO Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 5. UNIT TESTING CHALLENGES Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 6. How do you test it? Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 7. Testing on components Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 8. How do you start building an application architecture? Focus on? • building an architecture from scratch • thinking about how to achieve unit testing • start with modeling the database schema and data relations • using drag & drop programming • modeling the domain entities, relations, business rules • reusing existing code? • but, in the end, do you achieve 99,99% test code coverage? Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 9. Is unit testing achievable? 100%? Yes or No? Who knows? Maybe not! Possible answers: • The customer doesn't understand this need • Neither the management staff • Instead, everyone expects you to write the perfect code • As developers, every time we say: we need time to do it right! • But, do we need time or we don't know how to achieve it? Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 10. TODAY ARCHITECTURAL DESIGN Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 11. Let's start thinking to architecture design What? Right, now!? Hey, we have only 1 hour to finish this presentation!  Indeed, but let's try to do something! Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 12. What stops 100% unit testing? 1. Layers – How do we design them? 2. Business rules – Where and how do we implement? 3. Persistence – Should we use an ORM? … Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 13. 1 - Layers Presentation Business Data Access Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 14. 1 - Layers – any problems? Presentation Business Layers Coupling! Data Access A strong coupling conducts to a hard way to do: – unit testing – refactoring – agile development – or be opened for changes Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 15. 2 - Business rules Where should these be located? – Database – Business layer – User Interface (aka code behind!) How do we test them? – Running the application – Automatically, maybe using unit tests – Or we should let the customer test them!?  Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 16. And...what's inappropriate here? // somewhere in the business layer public class Patient { public DateTime Birthdate { get; set; } public int Age { // computed value get { return DateTime.Now.Year - this.Birthdate.Year; } Strong coupling! } public bool IsAdult { // business rule get { return this.Age >= 18; } } ... Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 17. 3 - Persistence Requirements • Persistence Ignorance / POCO • Help Domain Model stay out of infrastructure stuff • Decide where to store data (NoSQL?) • Use code generation or an Object Relation (O/R) Mapper – Metadata mapping • Support for the Unit of Work pattern Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 18. NEW APPROACH: DDD Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 19. Let's start with a new approach... Domain-Driven-Design • What is Domain? A new default architecture where: • the database is not the first focus • the layers are loosely coupled • the business rules are within the application Domain • it is easier to achieve unit testing • Why? Today we have the tools! Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 20. A new default architecture - DDD Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 21. Building blocks of DDD Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 22. TODAY'S TOOLS Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 23. Today's tools (from a web developer perspective) Dependency Injection frameworks – Manage dependencies – Castle Windsor, StructureMap, Spring.NET, Unity, ... ASP.NET MVC 3 – a mature web development platform based on MVC pattern Entity Framework 4.1 Code First / NHibernate – helps you focus on your domain Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 24. What is Dependency Injection? • = DI.Equals(IoC); // true or false? • IoC = Inversion of Control • DI = Dependency Injection • Helps you to decouple the application dependencies – Logging mechanisms (log4net, Enterprise Library Logging Application Block, ...) – Persistence mechanism (direct access to database, ORM) – User Interface dependencies on Domain services – Layers Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 25. Dependency Injection Log4netLogger PatientService PatientRepositoy Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 26. Dependency Injection 1) creates Builder PatientService Log4netLogger 2) inject dependencies 3) uses ILogger Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 27. ASP.NET MVC 3 and DI support • Based on MVC pattern • Provides better support for IoC – Views/Controllers • Model Validation support • Check IDependencyResolver interface – simplify service location and dependency resolution TService GetService<TService>() { … } IEnumerable<TService> GetServices<TService>() { … } Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 28. Persistance with EF 4.1 CodeFirst 1st version benefits: • CodeFirst development • Better POCO support • Mapping based on predefined conventions (Convention over configuration) • Fluent API for manual mapping entities to tables, no more .edmx files • Built-in Model-Level Validation • Dynamic database creation and dropping Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 29. DDD architecture with ASP.NET MVC 3, Unity, Entity Framework CodeFirst 4.1 DEMO Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 30. Conclusions Focus on – Analyze application dependencies – Business rules – Do refactoring! – Design your Domain – Don’t forget to do Unit testing Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 31. Resources Books • Domain-Driven Design, Tackling Complexity in the Heart of Software, by Eric Evans • Applying Domain-Driven Design and Patterns, With Examples in C# and .NET, by Jimmy Nilsson Online resources • http://domaindrivendesign.org/ • http://www.infoq.com/minibooks/domai n-driven-design-quickly Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 32. Elements of DDD with ASP.NET MVC & Entity Framework Code First Q&A Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro
  • 33. Don’t forget! Get your free Azure pass! We want your feedback! • 30+15 days, no CC req’d • Win a WP7 smartphone – http://bit.ly/ITCAMP11 – Fill in your feedback forms – Promo code: ITCAMP11 – Raffle: end of the day Premium conference on Microsoft’s Dev and ITPro technologies @itcampro / #itcampro