Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
2.04k
source
stringclasses
1 value
Implementing Domain Driven Design A practical guide for implementing the Domain Driven Design with the ABP Framework Halil İbrahim Kalkan
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design Implementing Domain Driven Design A practical guide for implementing the Domain Driven Design with the ABP Framework Halil İbrahim Kalkan Author: Halil İbrahim Kalkan Designer: Melis Platin Publish Date: June, 2021 (First Edition) Copyright 2021 @ Volosoft, All rights reserved
ABP Implementing_Domain_Driven_Design.pdf
ABP Implementing_Domain_Driven_Design.pdf
2 Implementing Domain Driven Design CONTENTS Introduction................................................................................................................. 4 What is the Domain Driven Design?........................................................... 7 Implementation: The Big Picture........................
ABP Implementing_Domain_Driven_Design.pdf
3 Implementing Domain Driven Design CONTENTS Implementation: The Building Blocks...................................................... 28 Example Use Cases................................................................................................. 82 Domain Logic & Application Logic...................................
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design INTRODUCTION This is a practical guide for implementing the Domain Driven Design (DDD). While the implementation details rely on the ABP Framework infrastructure, core concepts, principles and patterns are applicable in any kind of solution, even if it is not a . NET solution. 4
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design Goal The goals of this book are; ●Introduce and explain the DDD architecture, concepts, principles, patterns and building blocks. ●Explain the layered architecture & solution structure offered by the ABP Framework. ●Introduce explicit rules to implement DDD patterns and best practices ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design Simple Code! Playing football is very simple, but playing simple football is the hardest thing there is. — Johan Cruyff If we take this famous quote for programming, we can say; Writing code is very simple, but writing simple code is the hardest thing there is. — ??? In this document, ...
ABP Implementing_Domain_Driven_Design.pdf
7 Implementing Domain Driven Design What is the Domain Driven Design? Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model; DDD is suitable for complex domains and large-scale applications rather than simple CRUD applications. It focus...
ABP Implementing_Domain_Driven_Design.pdf
8 Implementing Domain Driven Design DDD Layers & Clean Architecture There are four fundamental layers of a Domain Driven Based Solution; Business Logic places into two layers, the Domain layer and the Application Layer, while they contain different kinds of business logic; ●Domain Layer implements the core, use-case in...
ABP Implementing_Domain_Driven_Design.pdf
9 Implementing Domain Driven Design ●Presentation Layer contains the UI elements (pages, components) of the application. ●Infrastructure Layer supports other layer by implementing the abstractions and integrations to 3rd-party library and systems. The same layering can be shown as the diagram below and known as the Cle...
ABP Implementing_Domain_Driven_Design.pdf
10 Implementing Domain Driven Design Core Building Blocks DDD mostly focuses on the Domain & Application Layers and ignores the Presentation and Infrastructure. They are seen as details and the business layers should not depend on them. That doesn't mean the Presentation and Infrastructure layers are not important. The...
ABP Implementing_Domain_Driven_Design.pdf
1 1 Implementing Domain Driven Design ●Aggregate & Aggregate Root: An Aggregate is a cluster of objects (entities and value objects) bound together by an Aggregate Root object. The Aggregate Root is a specific type of an entity with some additional responsibilities. ●Repository (interface): A Repository is a collection-...
ABP Implementing_Domain_Driven_Design.pdf
12 Implementing Domain Driven Design Application Layer Building Blocks ●Application Service: An Application Service is a stateless service that implements use cases of the application. An application service typically gets and returns DTOs. It is used by the Presentation Layer. It uses and coordinates the domain object...
ABP Implementing_Domain_Driven_Design.pdf
13 Implementing Domain Driven Design The solution name is Issue Tracking and it consists of multiple projects. The solution is layered by considering DDD principles as well as development and deployment practicals. The sub sections below explains the projects in the solution; Your solution structure may be slightly dif...
ABP Implementing_Domain_Driven_Design.pdf
14 Implementing Domain Driven Design The Domain Layer The Domain Layer is splitted into two projects; ●Issue Tracking. Domain is the essential domain layer that contains all the building blocks (entities, value objects, domain services, specifications, repository interfaces, etc. ) introduced before. ●Issue Tracking. Do...
ABP Implementing_Domain_Driven_Design.pdf
15 Implementing Domain Driven Design The Presentation Layer ●Issue Tracking. Web is an ASP. NET Core MVC / Razor Pages application for this example. This is the only executable application that serves the application and the APIs. ABP Framework also supports different kind of UI frameworks including Angular and Blazor....
ABP Implementing_Domain_Driven_Design.pdf
16 Implementing Domain Driven Design Most of the time, API Controllers are just wrappers around the Application Services to expose them to the remote clients. Since ABP Framework's Automatic API Controller System automatically configures and exposes your Application Services as API Controllers, you typically don't creat...
ABP Implementing_Domain_Driven_Design.pdf
17 Implementing Domain Driven Design The Infrastructure Layer In a DDD implementation, you may have a single Infrastructure project to implement all the abstractions and integrations, or you may have different projects for each dependency. We suggest a balanced approach; Create separate projects for main infrastructure...
ABP Implementing_Domain_Driven_Design.pdf
18 Implementing Domain Driven Design You may wonder why there are two projects for the EF Core. It is mostly related to modularity. Each module has its own independent Db Context and your application has also one Db Context. Db Migrations project contains a union of the modules to track and apply a single migration pat...
ABP Implementing_Domain_Driven_Design.pdf
19 Implementing Domain Driven Design The projects have been explained before. Now, we can explain the reasons of the dependencies; ●Domain. Shared is the project that all other projects directly or indirectly depend on. So, all the types in this project are available to all projects. ●Domain only depends on the Domain....
ABP Implementing_Domain_Driven_Design.pdf
20 Implementing Domain Driven Design ●Application depends on the Application. Contracts since it implements the Application Service interfaces and uses the DTOs inside it. It also depends on the Domain since the Application Services are implemented using the Domain Objects defined inside it. ●Entity Framework Core depen...
ABP Implementing_Domain_Driven_Design.pdf
21 Implementing Domain Driven Design Dashed Dependencies When you investigate the solution, you will see two more dependencies shown with the dashed lines in the figure above. Web project depends on the Application and Entity Framework Core projects which theoretically should not be like that but actually it is. This is...
ABP Implementing_Domain_Driven_Design.pdf
22 Implementing Domain Driven Design Execution Flow of a DDD Based Application The figure below shows a typical request flow for a web application that has been developed based on DDD patterns. ●The request typically begins with a user interaction on the UI (a use case) that causes an HTTP request to the server. ●An MVC ...
ABP Implementing_Domain_Driven_Design.pdf
23 Implementing Domain Driven Design ●The Application Service uses the Domain Objects (Entities, Repository interfaces, Domain Services, etc. ) to implement the use case. Application Layer implements some cross cutting concerns (Authorization, Validation, etc. ). An Application Service method should be a Unit Of Work. ...
ABP Implementing_Domain_Driven_Design.pdf
24 Implementing Domain Driven Design Here, the main reasons of this principle; 1. To make your domain/application infrastructure independent since the infrastructure may change in the future or you may need to support a second database type later. 2. To make your domain/application focus on the business code by hiding ...
ABP Implementing_Domain_Driven_Design.pdf
25 Implementing Domain Driven Design Examples; ●You can't assume Change Tracking since Mongo DB provider can't do it. So, you always need to explicitly update the changed entities. ●You can't use Navigation Properties (or Collections) to other Aggregates in your entities since this is not possible for a Document Databa...
ABP Implementing_Domain_Driven_Design.pdf
26 Implementing Domain Driven Design Presentation Technology Agnostic The presentation technology (UI Framework) is one of the most changed parts of a real world application. It is very important to design the Domain and Application Layers to be completely unaware of the presentation technology/framework. This principl...
ABP Implementing_Domain_Driven_Design.pdf
27 Implementing Domain Driven Design DDD ignores reporting and mass querying. That doesn't mean they are not important. If your application doesn't have fancy dashboards and reports, who would use it? However, reporting is another topic. You typically want to use the full power of the SQL Server or even use a separate ...
ABP Implementing_Domain_Driven_Design.pdf
28 Implementing Domain Driven Design Implementation: The Building Blocks This is the essential part of this guide. We will introduce and explain some explicit rules with examples. You can follow these rules and apply in your solution while implementing the Domain Driven Design. The Example Domain The examples will use ...
ABP Implementing_Domain_Driven_Design.pdf
29 Implementing Domain Driven Design Issue Aggregate consists of an Issue Aggregate Root that contains Comment and Issue Label collections. Other aggregates are shown as simple since we will focus on the Issue Aggregate: Aggregates As said before, an Aggregate is a cluster of objects (entities and value objects) bound ...
ABP Implementing_Domain_Driven_Design.pdf
30 Implementing Domain Driven Design Aggregate / Aggregate Root Principles Business Rules Entities are responsible to implement the business rules related to the properties of their own. The Aggregate Root Entities are also responsible for their sub-collection entities. An aggregate should maintain its self integrity a...
ABP Implementing_Domain_Driven_Design.pdf
31 Implementing Domain Driven Design That may seem strange to the developers used to work with EF Core & Relational Databases before. Getting the Issue with all details seems unnecessary and inefficient. Why don't we just execute an SQL Insert command to database without querying any data? The answer is that we should i...
ABP Implementing_Domain_Driven_Design.pdf
32 Implementing Domain Driven Design Example: Add a comment to an issue _issue Repository. Get Async method retrieves the Issue with all details (sub-collections) as a single unit by default. While this works out of the box for Mongo DB, you need to configure your aggregate details for the EF Core. But, once you configur...
ABP Implementing_Domain_Driven_Design.pdf
33 Implementing Domain Driven Design See the Loading Related Entities section of the EF Core document for the configuration and alternative scenarios. Issue. Add Comment gets a user Id and comment text, implements the necessary business rules and adds the comment to the Comments collection of the Issue. Finally, we use ...
ABP Implementing_Domain_Driven_Design.pdf
34 Implementing Domain Driven Design Transaction Boundary An aggregate is generally considered as a transaction boundary. If a use case works with a single aggregate, reads and saves it as a single unit, all the changes made to the aggregate objects are saved together as an atomic operation and you don't need to an exp...
ABP Implementing_Domain_Driven_Design.pdf
35 Implementing Domain Driven Design Aggregate / Aggregate Root Rules & Best Practices The following rules ensures implementing the principles introduced above. Reference Other Aggregates Only by ID The first rule says an Aggregate should reference to other aggregates only by their Id. That means you can not add navigat...
ABP Implementing_Domain_Driven_Design.pdf
36 Implementing Domain Driven Design ●Git Repository should not have a collection of the Issues since they are different aggregates. ●Issue should not have a navigation property for the related Git Repository since it is a different aggregate. ●Issue can have Repository Id (as a Guid). So, when you have an Issue and ne...
ABP Implementing_Domain_Driven_Design.pdf
37 Implementing Domain Driven Design Keep Aggregates Small One good practice is to keep an aggregate simple and small. This is because an aggregate will be loaded and saved as a single unit and reading/writing a big object has performance problems. See the example below: Role aggregate has a collection of User Role val...
ABP Implementing_Domain_Driven_Design.pdf
38 Implementing Domain Driven Design On the other hand, User may have such a Roles collection since a user doesn't have much roles in practical and it can be useful to have a list of roles while you are working with a User Aggregate. If you think carefully, there is one more problem when Role and User both have the lis...
ABP Implementing_Domain_Driven_Design.pdf
39 Implementing Domain Driven Design ●A sub-collection should not have more than 100-150 items inside it at the most case. If you think a collection potentially can have more items, don't define the collection as a part of the aggregate and consider to extract another aggregate root for the entity inside the collection....
ABP Implementing_Domain_Driven_Design.pdf
40 Implementing Domain Driven Design ●Organization has a Guid identifier ( Id). ●Organization User is a sub-collection of an Organization and has a composite primary key consists of the Organization Id and User Id. That doesn't mean sub-collection entities should always have composite PKs. They may have single Id proper...
ABP Implementing_Domain_Driven_Design.pdf
41 Implementing Domain Driven Design ●Checks validity of the parameters. ●Initializes sub-collections. Example Issue (Aggregate Root) constructor
ABP Implementing_Domain_Driven_Design.pdf
42 Implementing Domain Driven Design ●Issue class properly forces to create a valid entity by getting minimum required properties in its constructor as parameters. ●The constructor validates the inputs (Check. Not Null Or White Space(... ) throws Argument Exception if the given value is empty). ●It initializes the sub-...
ABP Implementing_Domain_Driven_Design.pdf
43 Implementing Domain Driven Design Entity Property Accessors & Methods The example above may seem strange to you! For example, we force to pass a non-null Title in the constructor. However, the developer may then set the Title property to null without any control. This is because the example code above just focuses o...
ABP Implementing_Domain_Driven_Design.pdf
44 Implementing Domain Driven Design Example: Methods to change the properties in a controlled way
ABP Implementing_Domain_Driven_Design.pdf
45 Implementing Domain Driven Design ●Repository Id setter made private and there is no way to change it after creating an Issue because this is what we want in this domain: An issue can't be moved to another repository. ●Title setter made private and Set Title method has been created if you want to change it later in ...
ABP Implementing_Domain_Driven_Design.pdf
46 Implementing Domain Driven Design ●Create domain specific exceptions. ●Throw these exceptions in the entity methods when necessary. Example:
ABP Implementing_Domain_Driven_Design.pdf
47 Implementing Domain Driven Design There are two business rules here; ●A locked issue can not be re-opened. ●You can not lock an open issue. Issue class throws an Issue State Exception in these cases to force the business rules: There are two potential problems of throwing such exceptions; 1. In case of such an excep...
ABP Implementing_Domain_Driven_Design.pdf
48 Implementing Domain Driven Design ABP's Exception Handling system solves these and similar problems. Example: Throwing a business exception with code ●Issue State Exception class inherits the Business Exception class. ABP returns 403 (forbidden) HTTP Status code by default (instead of 500-Internal Server Error) for ...
ABP Implementing_Domain_Driven_Design.pdf
49 Implementing Domain Driven Design Use constants instead of magic strings. And add an entry to the localization resource like below: ●When you throw the exception, ABP automatically uses this localized message (based on the current language) to show to the end user. ●The exception code (Issue Tracking:Can Not Open Lo...
ABP Implementing_Domain_Driven_Design.pdf
50 Implementing Domain Driven Design Business Logic in Entities Requiring External Services It is simple to implement a business rule in an entity method when the business logic only uses the properties of that entity. What if the business logic requires to query database or use any external services that should be res...
ABP Implementing_Domain_Driven_Design.pdf
51 Implementing Domain Driven Design Example: Business Rule: Can not assign more than 3 open issues to a user concurrently ●Assigned User Id property setter made private. So, the only way to change it to use the Assign To Async and Clean Assignment methods. ●Assign To Async gets an App User entity. Actually, it only us...
ABP Implementing_Domain_Driven_Design.pdf
52 Implementing Domain Driven Design ●Assign To Async throws exception if the business rule doesn't meet. ●Finally, if everything is correct, Assigned User Id property is set. This method perfectly guarantees to apply the business logic when you want to assign an issue to a user. However, it has some problems; ●It make...
ABP Implementing_Domain_Driven_Design.pdf
53 Implementing Domain Driven Design Common Repository principles are; ●Define a repository interface in the Domain Layer (because it is used in the Domain and Application Layers), implement in the Infrastructure Layer (Entity Framework Core project in the startup template). ●Do not include business logic inside the rep...
ABP Implementing_Domain_Driven_Design.pdf
54 Implementing Domain Driven Design Example: Get inactive issues from a repository IIssue Repository extends the standard IRepository<... > interface by adding a Get In Active Issues Async method. This repository works with such an Issue class: (the code shows only the properties we need for this example) The rule say...
ABP Implementing_Domain_Driven_Design.pdf
55 Implementing Domain Driven Design Let's see the implementation to understand it:
ABP Implementing_Domain_Driven_Design.pdf
56 Implementing Domain Driven Design (Used EF Core for the implementation. See the EF Core integration document to learn how to create custom repositories with the EF Core. ) When we check the Get In Active Issues Async implementation, we see a business rule that defines an in-active issue: The issue should be open, ass...
ABP Implementing_Domain_Driven_Design.pdf
57 Implementing Domain Driven Design We had to copy/paste/modify the code. What if the definition of the activeness changes? We should not forget to update both places. This is a duplication of a business logic, which is pretty dangerous. A good solution to this problem is the Specification Pattern ! Specifications A spec...
ABP Implementing_Domain_Driven_Design.pdf
58 Implementing Domain Driven Design Specification<T> base class simplifies to create a specification class by defining an expression. Just moved the expression here, from the repository. Now, we can re-use the In Active Issue Specification in the Issue entity and Ef Core Issue Repository classes. Using within the Entity Sp...
ABP Implementing_Domain_Driven_Design.pdf
59 Implementing Domain Driven Design Just created a new instance of the In Active Issue Specification and used its Is Satisfied By method to re-use the expression defined by the specification. Using with the Repositories First, starting from the repository interface: Renamed Get In Active Issues Async to simple Get Issues ...
ABP Implementing_Domain_Driven_Design.pdf
60 Implementing Domain Driven Design Since To Expression() method returns an expression, it can be directly passed to the Where method to filter the entities. Finally, we can pass any Specification instance to the Get Issues Async method: With Default Repositories Actually, you don't have to create custom repositories to...
ABP Implementing_Domain_Driven_Design.pdf
61 Implementing Domain Driven Design Async Executer is a utility provided by the ABP Framework to use asynchronous LINQ extension methods (like To List Async here) without depending on the EF Core Nu Get package. See the Repositories document for more information. Combining the Specifications One powerful side of the Sp...
ABP Implementing_Domain_Driven_Design.pdf
62 Implementing Domain Driven Design This Specification is parametric as a difference from the In Active Issue Specification. We can combine both specifications to get a list of inactive issues in a specific milestone:
ABP Implementing_Domain_Driven_Design.pdf
63 Implementing Domain Driven Design The example above uses the And extension method to combine the specifications. There are more combining methods are available, like Or(... ) and And Not(... ). See the Specifications document for more details about the specification infrastructure provided by the ABP Framework. Domain ...
ABP Implementing_Domain_Driven_Design.pdf
64 Implementing Domain Driven Design Example: Assigning an issue to a user Remember how an issue assignment has been implemented in the Issue entity: Here, we will move this logic into a Domain Service. First, changing the Issue class:
ABP Implementing_Domain_Driven_Design.pdf
65 Implementing Domain Driven Design ●Removed the assign-related methods. ●Changed Assigned User Id property's setter from private to internal, to allow to set it from the Domain Service. The next step is to create a domain service, named Issue Manager, that has Assign To Async to assign the given issue to the given us...
ABP Implementing_Domain_Driven_Design.pdf
66 Implementing Domain Driven Design We prefer and suggest to use the Manager suffix for the Domain Services. The only problem of this design is that Issue. Assigned User Id is now open to set out of the class. However, it is not public. It is internal and changing it is possible only inside the same Assembly, the Issue...
ABP Implementing_Domain_Driven_Design.pdf
67 Implementing Domain Driven Design Application Services An Application Service is a stateless service that implements use cases of the application. An application service typically gets and returns DTOs. It is used by the Presentation Layer. It uses and coordinates the domain objects (entities, repositories, etc. ) t...
ABP Implementing_Domain_Driven_Design.pdf
68 Implementing Domain Driven Design Example: Assigning an issue to a user
ABP Implementing_Domain_Driven_Design.pdf
69 Implementing Domain Driven Design An application service method typically has three steps those are implemented here; 1. Get the related domain objects from database to implement the use case. 2. Use domain objects (domain services, entities, etc. ) to perform the actual operation. 3. Update the changed entities in ...
ABP Implementing_Domain_Driven_Design.pdf
70 Implementing Domain Driven Design Data transfer Objects A DTO is a simple object that is used to transfer state (data) between the Application and Presentation Layers. So, Application Service methods gets and returns DTOs. Common DTO Principles & Best Practices ●A DTO should be serializable, by its nature. Because, ...
ABP Implementing_Domain_Driven_Design.pdf
71 Implementing Domain Driven Design Input DTO Best Practices Do not Define Unused Properties for Input DTOs Define only the properties needed for the use case! Otherwise, it will be confusing for the clients to use the Application Service method. You can surely define optional properties, but they should effect how the u...
ABP Implementing_Domain_Driven_Design.pdf
72 Implementing Domain Driven Design Example: User Application Service IUser App Service uses User Dto as the input DTO in all methods (use cases). User Dto is defined below: For this example; ●Id is not used in Create since the server determines it. ●Password is not used in Update since we have another method for it. ●...
ABP Implementing_Domain_Driven_Design.pdf
73 Implementing Domain Driven Design A true implementation can be like that: With the given input DTO classes:
ABP Implementing_Domain_Driven_Design.pdf
74 Implementing Domain Driven Design This is more maintainable approach although more code is written. Exceptional Case: There can be some exceptions for this rule: If you always want to develop two methods in parallel, they may share the same input DTO (by inheritance or direct reuse). For example, if you have a repor...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design Example: Using Data Annotation Attributes 75 ABP Framework automatically validates input DTOs, throws Abp Validation Exception and returns HTTP Status 400 to the client in case of an invalid input. Some developers think it is better to separate the validation rules and DTO classes. We ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 76 See the Validation document for all validation options. Output DTO Best Practices ●Keep output DTO count minimum. Reuse where possible (exception: Do not reuse input DTOs as output DTOs). ●Output DTOs can contain more properties than used in the client code. ●Return entity DTO from ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 77 Example: Returning Different DTOs from different methods (We didn't use async methods to make the example cleaner, but use async in your real world application!) The example code above returns different DTO types for each method. As you can guess, there will be a lot of code duplica...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 78 With a single output DTO: ●Removed Get User Name And Email and Get Roles since Get method already returns the necessary information. ●Get List now returns the same with Get. ●Create and Update also returns the same User Dto. Using the same DTO has a lot of advantages as explained be...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 79 Discussion Some of the output DTO suggestions may not fit in every scenario. These suggestions can be ignored for performance reasons, especially when large data sets returned or when you create services for your own UI and you have too many concurrent requests. In these cases, you m...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 80 ●Use auto object mapping only for Entity to output DTO mappings. ●Do not use auto object mapping for input DTO to Entity mappings. There are some reasons why you should not use input DTO to Entity auto mapping; 1. An Entity class typically has a constructor that takes parameters and...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 81 Example Use Cases This section will demonstrate some example use cases and discuss alternative scenarios. Entity Creation Creating an object from an Entity / Aggregate Root class is the first step of the lifecycle of that entity. The Aggregate / Aggregate Root Rules & Best Practices ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 82 ●This class guarantees to create a valid entity by its constructor. ●If you need to change the Title later, you need to use the Set Title method which continues to keep Title in a valid state. ●If you want to assign this issue to a user, you need to use Issue Manager (it implements ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 83 ●The Text property has a public setter, because it also accepts null values and does not have any validation rules for this example. It is also optional in the constructor. Let's see an Application Service method that is used to create an issue:
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 84 Create Async method; ●Uses the Issue constructor to create a valid issue. It passes the Id using the IGuid Generator service. It doesn't use auto object mapping here. ●If the client wants to assign this issue to a user on object creation, it uses the Issue Manager to do it by allowi...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 85 This rule should be implemented in a Domain Service, Issue Manager in this case. So, we need to force the Application Layer always to use the Issue Manager to create a new Issue. First, we can make the Issue constructor internal, instead of public: This prevents Application Services...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 86 ●Create Async method checks if there is already an issue with the same title and throws a business exception in this case. ●If there is no duplication, it creates and returns a new Issue.
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 87 The Issue App Service is changed as shown below in order to use the Issue Manager 's Create Async method:
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 88 Discussion: Why is the Issue not saved to the database in Issue Manager ? You may ask " Why didn't Issue Manager save the Issue to the database? ". We think it is the responsibility of the Application Service. Because, the Application Service may require additional changes/operation...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 89 Discussion: Why is the duplicate Title check not implemented in the Application Service? We could simply say "Because it is a core domain logic and should be implemented in the Domain Layer". However, it brings a new question " How did you decide that it is a core domain logic, but ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 90 ●You may have a button on the UI that converts something (for example, a discussion) to an issue. We can give more examples. All of these are should be implemented by different Application Service methods (see the Multiple Application Layers section below), but they always follow th...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 91 By comparing to Issue Creation Dto, you see no Repository Id. Because, our system doesn't allow to move issues across repositories (think as Git Hub repositories). Only Title is required and the other properties are optional. Let's see the Update implementation in the Issue App Serv...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 92 ●Update Async method gets id as a separate parameter. It is not included in the Update Issue Dto. This is a design decision that helps ABP to properly define HTTP routes when you auto expose this service as an HTTP API endpoint. So, that's not related to DDD. ●It starts by getting th...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 93 ●Finally uses the IObject Mapper to return an Issue Dto that is automatically created by mapping from the updated Issue entity. As said, we need some changes in the Issue and Issue Manager classes. First, made Set Title internal in the Issue class: Then added a new method to the Iss...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 94 Domain Logic & Application Logic As mentioned before, Business Logic in the Domain Driven Design is split into two parts (layers): Domain Logic and Application Logic : Domain Logic consists of the Core Domain Rules of the system while Application Logic implements application specific...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 95 Multiple Application Layers DDD helps to deal with complexity when your system is large. Especially, if there are multiple applications are being developed in a single domain, then the Domain Logic vs Application Logic separation becomes much more important. Assume that you are buil...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 96 Every application will have different requirements, different use cases (Application Service methods), different DTOs, different validation and authorization rules... etc. Mixing all these logics into a single application layer makes your services contain too many if conditions with...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 97 Such a design makes it even more important to distinguish between Domain logic and Application Logic. To be more clear about the implementation, you can create different projects (. csproj) for each application types. For example; ●Issue Tracker. Admin. Application & Issue Tracker. ...
ABP Implementing_Domain_Driven_Design.pdf
Implementing Domain Driven Design 98 Example: Creating a new Organization in a Domain Service
ABP Implementing_Domain_Driven_Design.pdf
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6