Call Us: +32 2 466 00 16
Email: info@u2u.be
Follow Us:

Domain-Driven Design with Entity Framework Core

3 days
UDEF
3 days

Upcoming Sessions

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Book now

Interested in a private company training? Request it here.

Introduction to Domain Driven Design

Ensuring that software meets its intended objectives can be challenging. Misalignment between business stakeholders and developers often arises due to differences in communication. Domain-Driven Design (DDD) aims to bridge this gap by establishing a common language between them.

  • What is Domain Driven Design?
  • Advantages of using Domain Driven Design
  • When is Domain Driven Design a bad option?

Architecting Modern Web Applications

What defines a modern web application? Is it one built with Angular and TypeScript? In the rapidly evolving landscape of web development, there's a risk that your website might utilize 'outdated' technology by the time it's completed. However, "Clean" architecture stands the test of time. As a wise saying goes, 'If you think good architecture is expensive, try bad architecture.'

  • "Clean" Architecture: put the business and application model at the center
  • Understanding the Core, Infrastructure and Presentation layer
  • Testing everything with Clean Architecture
  • LAB: Build the application structure using Clean Architecture principles

Unit testing in .NET

Every developer aspires to write code that is not only clean but also functional. However, achieving code that is easily maintainable and consistently operational poses a significant challenge. How does one navigate the complexities of software development to ensure that the code remains robust and reliable in the long run? In this context, we will explore the role of unit testing in verifying the correctness of our code and ensuring its continued functionality..

  • What every developer wants: Quality code that works; and keeps on working
  • Finding bugs: not just in code. - Or how NASA lost a 125.000.000$ Mars orbiter
  • What is unit testing? And what is a good unit test?
  • Understanding the difference between a unit test and an integration test
  • Test Driven Development - Should you be doing it?
  • Role-playing: Marge, Homer and Bart
  • The Triple-A of unit testing - and what has cooking to do with this?
  • Given-When-Then

Unit testing with Visual Studio with xUnit

When it comes to Unit Testing, you will need to choose frameworks. There are several options available, so which one do you need? Visual Studio comes with a built-in framework called MSTest, but you also have others, such as the popular xUnit. In this module, we will discuss the pros and cons of these frameworks and delve into some best practices. How can you determine if you have tested enough? Code coverage allows you to see which paths in your code you have tested and easily identify untested conditional logic.

  • Unit Testing best practices with XUnit
  • Facts and Theories
  • Using the Test Explorer Window
  • Live unit testing with Visual Studio
  • Running tests in parallel, or not
  • Measuring and improving Code Coverage
  • Replacing dependencies using Fakes, Stubs and Mocks
  • Building Stubs and Mocks using NSubstitute

Tactical Design

When constructing the domain model, there are several approaches. Tactical Design provides a set of technical resources and patterns used in the construction of the domain model. The goal is to enrich your domain model by correctly applying these patterns. When done effectively, it will reflect your business model with greater clarity and enable better communication and design.

  • What is tactical design?
  • Entities, Services, Aggregates, etc...
  • Applying Tactical Design to a real world business case

Tactical Design - Entities and Value Objects

Domain-Driven Design introduces a crucial distinction between Entities and Value Objects. But how does one effectively implement these concepts in practical software development using C# and .NET?

  • Differentiating between Entities and Value Objects
  • Designing Entities their Identity
  • Designing immutable Value Objects
  • Implementing Value Objects Equality efficiently
  • C# 9 records
  • LAB: Adding the Entities and Value Objects to the game store

Tactical Design - Domain Services and Modules

Some behaviors may not neatly align with existing Entities or Value Objects. In such instances, we encapsulate this behavior within a Domain Service. Now, how should we organize our business objects into Modules?

  • Providing domain specific operations with Domain Services
  • Domain, Infrastructure and Application Services
  • Segregating concepts using Modules
  • LAB: Adding some Domain Services to the game store

Strategic Design

One of the core pillars of Domain-Driven Design is Strategic Modeling. Strategic modeling assists in defining the Bounded Contexts, the Ubiquitous Language, and Context Maps.

  • Anti-Pattern: Big Ball of Mud
  • The linguistic delimitation that are Bounded Contexts
  • Identifying the terms and concepts with the Ubiquitous Language
  • Relating Bounded Contexts with Context Maps

Tactical Design - Life Cycle, Aggregates, Factories and Repositories

Grouping your entities into Aggregates can streamline development and mitigate the 'Death by a Thousand Dots' anti-pattern. Entities have lifecycles, but how do you create complex hierarchies of entities? Moreover, how do we abstract away the details of interacting with databases?

  • Clustering Entities and Value Objects with Aggregates
  • Anti-Pattern: Death by a Thousand Dots
  • Abstracting the creation of business objects with Factories
  • Data storage by using Repositories
  • Abstracting queries using Specifications
  • LAB: Implementing the life-cycle of your aggregates

Modeling your database with EF Core

Mapping in EF Core utilizes conventions, attributes, or the Fluent API. You'll learn how to leverage these tools to model your database in EF Core and implement the changes using Code-first Migrations.

  • Methods of configuration
  • Creating and applying migrations
  • Table and column mapping
  • Modeling properties
  • Mapping Value generated properties
  • Handling Concurrent updates
  • Modeling relationships
  • Mapping inheritance
  • LAB: Mapping your entities to the database with EF Core

Advanced EF: Mapping DDD to EF Core.

Domain-Driven Design is an excellent approach to begin designing your applications. Entity Framework Core is a powerful framework for accessing and manipulating your data stored in databases. Now, can we integrate Domain-Driven Design concepts into Entity Framework Core? Yes, indeed!

  • DDD and Persistance Ignorance
  • Implementing Value Objects with Owned Properties
  • Using Shadow Properties to Avoid 'Leaky Abstractions'
  • Building Repository and Specification classes
  • Testing your Specifications
  • Entity Validation
  • LAB: Optimizing the mapping of your entities

Tactical Design - Domain Events

When building larger applications, you aim to maintain low coupling and high cohesion. So, how do you implement changes that need to be handled by different subsystems?

  • What are Domain Events?
  • Publishing significant domain changes with Domain Events
  • Using MediatR with Domain Events
  • LAB: Adding Domain Events to the game store application

Unit Testing ASP.NET Core Web Applications

When creating modern web applications with ASP.NET Core MVC, unit testing the Controllers and Views isn't straightforward. How does one validate whether the ActionResult returned by the Controller action is the expected one, and whether the View is correct? How do we replace dependencies during testing with MVC? How do we perform end-to-end testing?

  • Challenges when unit testing MVC applications
  • Writing unit tests for your MVC controllers
  • Unit testing ApiControllers
  • Testing data access, such as Repositories and Specifactions
  • Using the ASP.NET Core testing framework
  • End-to-end testing
  • LAB: Implementing integration and end-to-end tests

When architecting and developing applications, various approaches warrant consideration. Among these, Domain-Driven Design (DDD) stands prominent. The core idea of Domain-Driven Design is to base the software development process on the business domain itself, ensuring that business experts and developers are aligned in their understanding and objectives. In the realm of business applications, the necessity for a data access layer to interface with databases is common. Enter Entity Framework Core (EF Core), a tool that seamlessly integrates with DDD principles. This course delves into the fundamentals of Domain-Driven Design and illustrates how EF Core can be instrumental in applying these principles effectively.

Attendees are required to have prior knowledge of C# and .NET. Participants in this course will explore modern architecture principles and engage in a hands-on project to construct a website using C#, DDD, EF Core, and Unit Testing.

Contact Us
  • Address:
    U2U nv/sa
    Z.1. Researchpark 110
    1731 Zellik (Brussels)
    BELGIUM
  • Phone: +32 2 466 00 16
  • Email: info@u2u.be
  • Monday - Friday: 9:00 - 17:00
    Saturday - Sunday: Closed
Say Hi
© 2024 U2U All rights reserved.