Code Monkey home page Code Monkey logo

ecommerce8's Introduction

pre-req: you'll need mssql
MockProductsAndInventory - to seed some sample data

You'll also need .NET9 SDK as well https://dotnet.microsoft.com/en-us/download/dotnet/9.0

Domain-Driven Design for Microservice Architecture .Net9

First attempt on creating an Ecommerce store with a DDD driven architecture design. Documentation in Progress.

Apply CQRS & DDD in MA

Applying simplified CQRS and DDD patterns in a microservice | Microsoft Docs

The basic idea is that you can divide a system's operations into two sharply separated categories:

  • Queries. These queries return a result and do not change the state of the system, and they are free of side effects.

  • Commands. These commands change the state of a system.

Implement reads/queries in a CQRS microservice

Implementing reads/queries in a CQRS microservice | Microsoft Docs

Sample DDD Layer Design in MA

Designing a DDD-oriented microservice | Microsoft Docs

Application Layer

  • Defines the jobs the software is supposed to do and directs the expressive domain objects to work out problems
  • Layer is kept thin, does not contain business rules or knowledge, but only coordinates tasks and delegates work to collaborations of domain objects in the next layer down

Domain Layer

  • Responsible for representing concepts of the business, information about the business situation, and business rules. State that reflects the business situation is controlled and used here, even though the technical details of storing it are delegated to the infrastructure.

Infrastructure Layer

  • The infrastructure layer is how the data that is initially held in domain entities (in memory) is persisted in databases or another persistent store. An example is using Entity Framework Core code to implement the Repository pattern classes that use a DBContext to persist data in a relational database.

Domain Implementation

Implementing a microservice domain model with .NET | Microsoft Docs

  • DDD talks about problems as domains. It describes independent problem areas as Bounded Contexts (each Bounded Context correlates to a microservice)

  • DDD approaches should be applied only if you are implementing complex microservices with significant business rules. Simpler responsibilities, like a CRUD service, can be managed with simpler approaches

Structure aggregates in a custom .NET Standard library

  • An aggregate refers to a cluster of domain objects grouped together to match transactional consistency

  • Transactional consistency means that an aggregate is guaranteed to be consistent and up to date at the end of a business action

Infrastructure Implementation

  • Data persistence components provide access to the data hosted within the boundaries of a microservice
  • Repositories are classes or components that encapsulate the logic required to access data sources
  • For each aggregate or aggregate root, you should create one repository class. In a microservice based on Domain-Driven Design (DDD) patterns, the only channel you should use to update the database should be the repositories. This is because they have a one-to-one relationship with the aggregate root, which controls the aggregate's invariants and transactional consistency
  • Repository allows you to populate data in memory that comes from the database in the form of the domain entities. Once the entities are in memory, they can be changed and then persisted back to the database through transactions.

ecommerce8's People

Contributors

tenghy23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.