Coder Social home page Coder Social logo

thangchung / clean-architecture-dotnet Goto Github PK

View Code? Open in Web Editor NEW
1.2K 37.0 246.0 4.8 MB

๐Ÿ•ธ Yet Another .NET Clean Architecture, but for Microservices project. It uses Minimal Clean Architecture with DDD-lite, CQRS-lite, and just enough Cloud-native patterns apply on the simple eCommerce sample and run on Tye with Dapr extension ๐Ÿป

License: MIT License

C# 100.00%
ddd ddd-architecture ddd-patterns clean-architecture microservices microservices-architecture mediatr cqrs kubernetes containers

clean-architecture-dotnet's Issues

i18n

Some of investigating besides the default options in Blazor: https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-6.0

[Sample] Dashboard statistics

We might have some information such as:

  • Total products
  • Completed orders (we might add cart and order services then)
  • Unfinished orders (we might add cart and order services then)
  • New users or customers
  • Latest products, customers, orders
  • Sale on last 30 days

Look at the sample at

the branch inmem-outbox cannot run with tye

hi @thangchung, I would like to use this in our products.

But seem like the latest version of inmem-outbox branch cannot build and run with tye. I keep getting this error:

Loading Application Details...
Evaluating project failed with exit code 1
Drats! 'run' failed:
Evaluated project metadata file could not be found for service productapp

Setup Dapr OAuth 2.0 with identityserver

Right now, we don't authentication the between Dapr sidecar and the application itself

Look at it:

// Dapr pubsub
app.MapPost("/CustomerCreated", (CustomerCreatedIntegrationEvent @event) =>
{
    Console.WriteLine($"I received the message with name={@event.GetType().FullName}");
    return Ok("Subscribed");
}).WithTopic("pubsub", "CustomerCreatedIntegrationEvent");

// Dapr cron job binding
app.MapPost("/ProductOutboxCron", async (ITxOutboxProcessor outboxProcessor) =>
    await outboxProcessor.HandleAsync(typeof(CoolStore.IntegrationEvents.Anchor)));

Cant build via docker in m1

` clean-architecture-dotnet git:(main) โœ— sudo docker-compose build --no-cache
postgresql uses an image, skipping
placement uses an image, skipping
redis uses an image, skipping
settingapp-dapr uses an image, skipping
customerapp-dapr uses an image, skipping
productapp-dapr uses an image, skipping
webapigatewayapp-dapr uses an image, skipping
Building settingapp
[+] Building 2.5s (15/17)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 680B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 35B 0.0s
=> [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0 0.2s
=> [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:6.0 0.2s
=> [internal] load build context 0.1s
=> => transferring context: 33.98kB 0.1s
=> [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:1c008d2e442b82f7dd0118999f439c5641efdcd527f40b44bff6c273d8836a04 0.0s
=> [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:6.0@sha256:044457748f69c79c5617cbf3c2da389e8833d8bead76a6875e9df071868bc74c 0.0s
=> CACHED [build 2/7] WORKDIR /src 0.0s
=> CACHED [base 2/2] WORKDIR /app 0.0s
=> CACHED [final 1/2] WORKDIR /app 0.0s
=> [build 3/7] COPY [samples/Setting/SettingService.Api/SettingService.Api.csproj, SettingService.Api/] 0.0s
=> [build 4/7] RUN dotnet restore "./SettingService.Api/SettingService.Api.csproj" 0.6s
=> [build 5/7] COPY . . 0.1s
=> [build 6/7] WORKDIR /src/SettingService.Api 0.0s
=> ERROR [build 7/7] RUN dotnet build "SettingService.Api.csproj" -c Release -o /app/build 1.4s

[build 7/7] RUN dotnet build "SettingService.Api.csproj" -c Release -o /app/build:
#15 0.214 Microsoft (R) Build Engine version 17.0.0-preview-21302-02+018bed83d for .NET
#15 0.214 Copyright (C) Microsoft Corporation. All rights reserved.
#15 0.214
#15 0.475 Determining projects to restore...
#15 0.477 Skipping project "/src/N8T.Core/N8T.Core.csproj" because it was not found.
#15 0.477 Skipping project "/src/N8T.Infrastructure.EfCore/N8T.Infrastructure.EfCore.csproj" because it was not found.
#15 0.477 Skipping project "/src/N8T.Infrastructure.OTel/N8T.Infrastructure.OTel.csproj" because it was not found.
#15 0.477 Skipping project "/src/N8T.Infrastructure/N8T.Infrastructure.csproj" because it was not found.
#15 0.477 Skipping project "/DataContracts/CoolStore.AppContracts/CoolStore.AppContracts.csproj" because it was not found.
#15 0.477 Skipping project "/DataContracts/CoolStore.IntegrationEvents/CoolStore.IntegrationEvents.csproj" because it was not found.
#15 0.477 Skipping project "/src/SettingService.AppCore/SettingService.AppCore.csproj" because it was not found.
#15 0.477 Skipping project "/src/SettingService.Infrastructure/SettingService.Infrastructure.csproj" because it was not found.
#15 0.478 Skipping project "/src/N8T.Core/N8T.Core.csproj" because it was not found.
#15 0.478 Skipping project "/src/N8T.Infrastructure.EfCore/N8T.Infrastructure.EfCore.csproj" because it was not found.
#15 0.478 Skipping project "/src/N8T.Infrastructure.OTel/N8T.Infrastructure.OTel.csproj" because it was not found.
#15 0.478 Skipping project "/src/N8T.Infrastructure/N8T.Infrastructure.csproj" because it was not found.
#15 0.478 Skipping project "/DataContracts/CoolStore.AppContracts/CoolStore.AppContracts.csproj" because it was not found.
#15 0.478 Skipping project "/DataContracts/CoolStore.IntegrationEvents/CoolStore.IntegrationEvents.csproj" because it was not found.
#15 0.478 Skipping project "/src/SettingService.AppCore/SettingService.AppCore.csproj" because it was not found.
#15 0.478 Skipping project "/src/SettingService.Infrastructure/SettingService.Infrastructure.csproj" because it was not found.
#15 0.590 All projects are up-to-date for restore.
#15 0.647 You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Core/N8T.Core.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure.EfCore/N8T.Infrastructure.EfCore.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure.OTel/N8T.Infrastructure.OTel.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure/N8T.Infrastructure.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../DataContracts/CoolStore.AppContracts/CoolStore.AppContracts.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../DataContracts/CoolStore.IntegrationEvents/CoolStore.IntegrationEvents.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../SettingService.AppCore/SettingService.AppCore.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 0.696 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../SettingService.Infrastructure/SettingService.Infrastructure.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.400 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407
#15 1.407 Build FAILED.
#15 1.407
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Core/N8T.Core.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure.EfCore/N8T.Infrastructure.EfCore.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure.OTel/N8T.Infrastructure.OTel.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../../src/N8T.Infrastructure/N8T.Infrastructure.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../DataContracts/CoolStore.AppContracts/CoolStore.AppContracts.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../../DataContracts/CoolStore.IntegrationEvents/CoolStore.IntegrationEvents.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../SettingService.AppCore/SettingService.AppCore.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.407 /usr/share/dotnet/sdk/6.0.100-preview.5.21302.13/Microsoft.Common.CurrentVersion.targets(1966,5): warning : The referenced project '../SettingService.Infrastructure/SettingService.Infrastructure.csproj' does not exist. [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.408 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/SettingService.Api/SettingService.Api.csproj]
#15 1.408 8 Warning(s)
#15 1.408 1 Error(s)
#15 1.408
#15 1.408 Time Elapsed 00:00:01.16


executor failed running [/bin/sh -c dotnet build "SettingService.Api.csproj" -c Release -o /app/build]: exit code: 1
ERROR: Service 'settingapp' failed to build : Build failed`

im new for dotnet and docker also looking for simple architecture project for long run. seem like its trying to find main method inside docker. any help would be greatly appreciated

Extension.ApplySorting parameters are incorrect

    public static void ApplySorting(this IRootSpecification gridSpec,
        string sort,
        string orderByDescendingMethodName,
        string groupByMethodName)
    {

should be

    public static void ApplySorting(this IRootSpecification gridSpec,
        string sort,
        string orderByMethodName,
        string orderByDescendingMethodName)
    {

and very last "else" block should be...

            else
            {
                specificationType.GetMethod(
                        orderByMethodName,
                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                    .Invoke(gridSpec, new object[] { propertyReturningExpression });
            }

awesome sample....thank you.

Refactor to the truly minimal routing on each services

  1. To make it truly minimal, we need to refactor it to Map router on each service (that's mean we remove Swagger on each host, but I think after 6.0.100-preview.6.21308.9 SDK released, then we can bring back Swagger, see at https://github.com/halter73/swagger), and map it like https://github.com/halter73/MinimalWeather/blob/main/dotnet/MinimalWeather/Program.cs and https://github.com/dodyg/practical-aspnetcore/blob/net5.0/projects/net6/web-application-8/src/Program.cs, and https://github.com/425show/MinimalWeather/blob/main/Program.cs

  2. Refactor to 3 projects (one service - core + app and API only to make it is more simply), refactor App layer only contain interfaces + use cases + model only (and depends on Infrastructure layer)

  • CoreApp: Core + App layers
  • Infrastructure layer
  • API layer
  1. Then we write the aggregator like https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/src/ApiGateways/Web.Bff.Shopping/aggregator, the reason is we need one centralize endpoints with swagger.json file, then we will use some kind of Swagger Client Generator like https://github.com/RicoSuter/NSwag/wiki/NSwagStudio to generate the HTTP client with all APIs we have. Then we can use it inside the Blazor app (we gonna refactor to remove the current web which is implemented using nextjs. But need to investigate more

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.