├── src
├── Architecture
│ ├── ThreeTier
│ │ ├── Aoxe.ThreeTier.Abstractions
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── DataAccess
│ │ │ │ └── DataAccessLayer.cs
│ │ │ ├── BusinessLogic
│ │ │ │ ├── BusinessLogicLayer.cs
│ │ │ │ └── MessageHandler.cs
│ │ │ └── Aoxe.ThreeTier.Abstractions.csproj
│ │ └── Aoxe.ThreeTier
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── Aoxe.IServiceCollection.Extensions.cs
│ │ │ ├── Aoxe.IServiceCollection.Extensions.Dal.cs
│ │ │ ├── Aoxe.IServiceCollection.Extensions.Bll.cs
│ │ │ └── Aoxe.ThreeTier.csproj
│ └── DDD
│ │ ├── Aoxe.DDD.Abstractions
│ │ ├── Application
│ │ │ ├── IntegrationEvent.cs
│ │ │ ├── ApplicationService.cs
│ │ │ └── IntegrationEventHandler.cs
│ │ ├── Domain
│ │ │ ├── Command.cs
│ │ │ ├── ValueObject.cs
│ │ │ ├── DomainService.cs
│ │ │ ├── Factory.cs
│ │ │ ├── AggregateRoot.cs
│ │ │ ├── DomainEventHandler.cs
│ │ │ ├── DomainEvent.cs
│ │ │ └── Entity.cs
│ │ ├── GlobalUsings.cs
│ │ ├── Infrastructure
│ │ │ ├── Messaging
│ │ │ │ └── IMessageBus.cs
│ │ │ └── Repository
│ │ │ │ └── Repository.cs
│ │ └── Aoxe.DDD.Abstractions.csproj
│ │ └── Aoxe.DDD
│ │ ├── DomainEventSubscriber.cs
│ │ ├── Aoxe.IServiceCollection.Extensions.Repository.cs
│ │ ├── Aoxe.IServiceCollection.Extensions.cs
│ │ ├── Aoxe.IServiceCollection.Extensions.Application.cs
│ │ ├── GlobalUsings.cs
│ │ ├── Aoxe.IServiceCollection.Extensions.Domain.cs
│ │ ├── Aoxe.DDD.csproj
│ │ └── DomainEventPublisher.cs
├── Client
│ ├── Http
│ │ ├── Formatters
│ │ │ ├── Aoxe.Client.Http.MsgPack
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptionsExtensions.cs
│ │ │ │ └── Aoxe.Client.Http.MsgPack.csproj
│ │ │ ├── Aoxe.Client.Http.Protobuf
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptionsExtensions.cs
│ │ │ │ └── Aoxe.Client.Http.Protobuf.csproj
│ │ │ ├── Aoxe.Client.Http.Zeroformatter
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptionsExtensions.cs
│ │ │ │ └── Aoxe.Client.Http.Zeroformatter.csproj
│ │ │ ├── Aoxe.Client.Http.Jil
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptionsExtensions.cs
│ │ │ │ └── Aoxe.Client.Http.Jil.csproj
│ │ │ ├── Aoxe.Client.Http.Utf8Json
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptionsExtensions.cs
│ │ │ │ └── Aoxe.Client.Http.Utf8Json.csproj
│ │ │ └── Aoxe.Client.Http.Formatter
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeClientFormatterOptions.cs
│ │ │ │ ├── AoxeHttpClientFormatterFactory.cs
│ │ │ │ ├── AoxeHttpClientFormatter.cs
│ │ │ │ ├── AoxeHttpClientStreamFormatter.cs
│ │ │ │ ├── Aoxe.Client.Http.Formatter.csproj
│ │ │ │ └── AoxeHttpClientTextFormatter.cs
│ │ └── Aoxe.Client.Http
│ │ │ ├── Internal
│ │ │ ├── StringExtensions.cs
│ │ │ ├── TaskExtensions.cs
│ │ │ ├── AsyncExtensions.cs
│ │ │ ├── TaskCompletionSource.cs
│ │ │ └── ZaabyClientProxy.cs
│ │ │ ├── GlobalUsings.cs
│ │ │ └── Aoxe.Client.Http.csproj
│ └── Grpc
│ │ └── Aoxe.Client.Grpc
│ │ └── Aoxe.Client.Grpc.csproj
├── Aoxe.Shared
│ ├── LoadMode.cs
│ ├── GlobalUsings.cs
│ ├── TypePair.cs
│ ├── Aoxe.IServiceCollection.Extensions.LoadByDirectories.cs
│ ├── LoadHelper.LoadByAssemblies.cs
│ ├── Aoxe.IServiceCollection.Extensions.LoadByAssemblies.cs
│ ├── LoadHelper.LoadTypes.cs
│ ├── Aoxe.IServiceCollection.Extensions.Register.cs
│ ├── LoadHelper.LoadByDirectory.cs
│ └── Aoxe.Shared.csproj
├── Server
│ ├── WebApi
│ │ ├── Aoxe.WebApi.Formatters
│ │ │ ├── Aoxe.AspNetCore.Formatters
│ │ │ │ ├── SerializeProcessor.cs
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── AoxeOutputFormatter.cs
│ │ │ │ ├── StreamExtensions.cs
│ │ │ │ ├── AoxeTextOutputFormatter.cs
│ │ │ │ ├── AoxeInputFormatter.cs
│ │ │ │ ├── AoxeTextInputFormatter.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.csproj
│ │ │ ├── Aoxe.AspNetCore.Formatters.MsgPack
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── README.md
│ │ │ │ ├── MvcBuilderExtension.cs
│ │ │ │ ├── MvcOptionsExtension.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.MsgPack.csproj
│ │ │ ├── Aoxe.AspNetCore.Formatters.Protobuf
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── README.md
│ │ │ │ ├── MvcBuilderExtension.cs
│ │ │ │ ├── MvcOptionsExtension.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.Protobuf.csproj
│ │ │ ├── Aoxe.AspNetCore.Formatters.ZeroFormatter
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── README.md
│ │ │ │ ├── MvcBuilderExtension.cs
│ │ │ │ ├── MvcOptionsExtension.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.ZeroFormatter.csproj
│ │ │ ├── Aoxe.AspNetCore.Formatters.Jil
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── README.md
│ │ │ │ ├── MvcBuilderExtension.cs
│ │ │ │ ├── MvcOptionsExtension.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.Jil.csproj
│ │ │ ├── Aoxe.AspNetCore.Formatters.Utf8Json
│ │ │ │ ├── GlobalUsings.cs
│ │ │ │ ├── README.md
│ │ │ │ ├── MvcBuilderExtension.cs
│ │ │ │ ├── MvcOptionsExtension.cs
│ │ │ │ └── Aoxe.AspNetCore.Formatters.Utf8Json.csproj
│ │ │ └── README.md
│ │ └── Aoxe.WebApi
│ │ │ ├── Aoxe.IServiceCollection.Extensions.UnitOfWork.cs
│ │ │ ├── UnitOfWorkMiddleware.cs
│ │ │ ├── AoxeAppServiceControllerFeatureProvider.cs
│ │ │ ├── Aoxe.IApplicationBuilder.Extensions.cs
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── AoxeActionModelConvention.cs
│ │ │ ├── Aoxe.WebApi.csproj
│ │ │ └── ErrorHandlingMiddleware.cs
│ └── Grpc
│ │ └── Aoxe.Grpc
│ │ ├── GlobalUsings.cs
│ │ └── Aoxe.Grpc.csproj
├── Aoxe.Core
│ ├── AoxeMessage.cs
│ ├── AoxeError.cs
│ ├── AoxeException.cs
│ ├── AoxeUnpublishedMessage.cs
│ ├── AoxePublishedMessage.cs
│ └── Aoxe.Core.csproj
├── Aoxe
│ ├── AoxeHost.Extensions.DDD.cs
│ ├── AoxeHost.Extensions.ThreeTies.cs
│ ├── AoxeHost.Extensions.UnitOfWork.cs
│ ├── AoxeHost.Extensions.Client.cs
│ ├── GlobalUsings.cs
│ ├── AoxeHost.Extensions.HostService.cs
│ └── Aoxe.csproj
├── PubSub
│ ├── Aoxe.AutoSubscribe
│ │ └── Aoxe.AutoSubscribe.csproj
│ ├── Aoxe.PubSub.Local
│ │ ├── Aoxe.PubSub.Local.MediatR
│ │ │ └── Aoxe.PubSub.Local.MediatR.csproj
│ │ ├── Aoxe.PubSub.Local.Abstractions
│ │ │ └── Aoxe.PubSub.Local.Abstractions.csproj
│ │ └── Aoxe.PubSub.Local.MessagePipe
│ │ │ └── Aoxe.PubSub.Local.MessagePipe.csproj
│ └── Aoxe.PubSub.Distributed
│ │ ├── Aoxe.PubSub.Distributed.Kafka
│ │ └── Aoxe.PubSub.Distributed.Kafka.csproj
│ │ ├── Aoxe.PubSub.Distributed.NATS
│ │ └── Aoxe.PubSub.Distributed.NATS.csproj
│ │ ├── Aoxe.PubSub.Distributed.ZeroMQ
│ │ └── Aoxe.PubSub.Distributed.ZeroMQ.csproj
│ │ ├── Aoxe.PubSub.Distributed.RabbitMQ
│ │ └── Aoxe.PubSub.Distributed.RabbitMQ.csproj
│ │ ├── Aoxe.PubSub.Distributed.RedisStream
│ │ └── Aoxe.PubSub.Distributed.RedisStream.csproj
│ │ ├── Aoxe.PubSub.Distributed.Abstractions
│ │ └── Aoxe.PubSub.Distributed.Abstractions.csproj
│ │ └── Aoxe.PubSub.LocalMessageStorage.EntityFramework
│ │ └── Aoxe.PubSub.LocalMessageStorage.EntityFramework.csproj
└── Scheduling
│ ├── Aoxe.Quartz
│ └── Aoxe.Quartz.csproj
│ └── Aoxe.Hangfire
│ └── Aoxe.Hangfire.csproj
├── demo
├── Aoxe
│ ├── Interfaces
│ │ ├── IService.cs
│ │ ├── IMessage.cs
│ │ ├── ServiceAttribute.cs
│ │ ├── Interfaces.csproj
│ │ └── IConsumer.cs
│ ├── AliceSystem
│ │ ├── AliceServices
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── NonContractService.cs
│ │ │ ├── RouteAttributeService.cs
│ │ │ └── AliceServices.csproj
│ │ └── IAliceServices
│ │ │ ├── Apple.cs
│ │ │ ├── IAliceServices.csproj
│ │ │ └── IAliceService.cs
│ ├── AliceHost
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Controllers
│ │ │ └── HealthCheck.cs
│ │ ├── Program.cs
│ │ ├── GlobalUsings.cs
│ │ └── AliceHost.csproj
│ ├── CarolHost
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Program.cs
│ │ ├── GlobalUsings.cs
│ │ └── CarolHost.csproj
│ ├── BobSystem
│ │ ├── IBobServices
│ │ │ ├── IBobServices.csproj
│ │ │ └── IBobService.cs
│ │ └── BobServices
│ │ │ └── BobServices.csproj
│ ├── CarolSystem
│ │ ├── ICarolServices
│ │ │ ├── ICarolServices.csproj
│ │ │ └── ICarolService.cs
│ │ └── CarolServices
│ │ │ ├── CarolServices.csproj
│ │ │ └── CarolService.cs
│ └── BobHost
│ │ ├── GlobalUsings.cs
│ │ ├── BobHost.csproj
│ │ └── Program.cs
├── Aoxe.AspNetCore.Formatters.Demo
│ ├── TestEnum.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Controllers
│ │ └── ValuesController.cs
│ ├── Program.cs
│ ├── GlobalUsings.cs
│ ├── TestDto.cs
│ ├── Startup.cs
│ └── Aoxe.AspNetCore.Formatters.Demo.csproj
├── Aoxe.DDD
│ ├── MicroService
│ │ ├── Domain
│ │ │ ├── ValueObjects
│ │ │ │ ├── Gender.cs
│ │ │ │ └── Address.cs
│ │ │ ├── IRepositories
│ │ │ │ └── IUserRepository.cs
│ │ │ ├── Domain.csproj
│ │ │ ├── Entities
│ │ │ │ └── Card.cs
│ │ │ ├── DomainEvents
│ │ │ │ ├── UserCreatedEvent.cs
│ │ │ │ ├── UserNameChangedEvent.cs
│ │ │ │ ├── UserBirthdayCelebratedEvent.cs
│ │ │ │ ├── UserTagsSetEvent.cs
│ │ │ │ └── UserCardAddedEvent.cs
│ │ │ ├── README.md
│ │ │ └── DomainServices
│ │ │ │ └── UserDomainService.cs
│ │ ├── ServiceHost
│ │ │ ├── appsettings.Development.json
│ │ │ ├── Program.cs
│ │ │ ├── appsettings.json
│ │ │ ├── UowMiddleware.cs
│ │ │ ├── ServiceCollectionExtension.cs
│ │ │ ├── GlobalUsings.cs
│ │ │ ├── ServiceHost.csproj
│ │ │ └── DomainEventBackgroundService.cs
│ │ ├── Application
│ │ │ ├── Application.csproj
│ │ │ └── README.md
│ │ ├── README.md
│ │ └── Repository
│ │ │ ├── Repository.csproj
│ │ │ ├── CustomDbContext.cs
│ │ │ ├── README.md
│ │ │ └── UserRepository.cs
│ └── BackendForFrontend
│ │ ├── BackendForBrowser
│ │ ├── images
│ │ │ ├── Richardson_tAGP_01.png
│ │ │ ├── Richardson_tAGP_03.png
│ │ │ ├── Richardson_tAGP_04.png
│ │ │ └── Richardson_tAGP_05.png
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Program.cs
│ │ ├── BackendForBrowser.csproj
│ │ ├── ServiceCollectionExtension.cs
│ │ ├── Startup.cs
│ │ └── README.md
│ │ ├── QueryService
│ │ ├── Models
│ │ │ └── UserReadModel.cs
│ │ ├── QueryService.csproj
│ │ ├── README.md
│ │ └── UserQueryService.cs
│ │ └── README.md
└── Aoxe.ThreeTier
│ ├── Model
│ ├── Model.csproj
│ └── User.cs
│ ├── BusinessLogicLayer
│ ├── Dtos
│ │ ├── LoginRequestParam.cs
│ │ └── CreateUserDto.cs
│ ├── BusinessLogicLayer.csproj
│ └── UserBll.cs
│ ├── WebApiHost
│ ├── appsettings.Development.json
│ ├── Program.cs
│ ├── ServiceCollectionExtension.cs
│ ├── appsettings.json
│ ├── GlobalUsings.cs
│ ├── WebApiHost.csproj
│ └── Startup.cs
│ ├── DataAccessLayer
│ ├── DataAccessLayer.csproj
│ └── UserDal.cs
│ └── ConsoleHost
│ ├── ConsoleHost.csproj
│ └── Program.cs
├── tests
├── Aoxe.AspNetCore.Formatters.Tests
│ ├── GlobalUsing.cs
│ ├── MsgPack.Formatter.Test.cs
│ ├── Utf8Json.Formatter.Test.cs
│ ├── Protobuf.Formatter.Test.cs
│ ├── ZeroFormatter.Formatter.Test.cs
│ ├── AspNetCoreFormatterTest.cs
│ ├── Jil.Formatter.Test.cs
│ ├── Aoxe.AspNetCore.Formatters.Tests.csproj
│ ├── AspNetCoreFormatterTest.Text.cs
│ └── AspNetCoreFormatterTest.Stream.cs
└── Aoxe.Shared.Test
│ └── Aoxe.Shared.Test.csproj
├── README.md
├── azure-pipelines.yml
└── LICENSE
/src/Architecture/ThreeTier/Aoxe.ThreeTier.Abstractions/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
--------------------------------------------------------------------------------
/demo/Aoxe/Interfaces/IService.cs:
--------------------------------------------------------------------------------
1 | namespace Interfaces
2 | {
3 | public interface IService
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/Aoxe/Interfaces/IMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Interfaces
2 | {
3 | public interface IMessage
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.MsgPack/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Aoxe.Client.Http.Formatter;
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Protobuf/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Aoxe.Client.Http.Formatter;
--------------------------------------------------------------------------------
/src/Aoxe.Shared/LoadMode.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Shared;
2 |
3 | public enum LoadTypesMode
4 | {
5 | LoadBySpecify,
6 | LoadByAllDirectory
7 | }
8 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Zeroformatter/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Aoxe.Client.Http.Formatter;
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Jil/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Aoxe.Client.Http.Formatter;
4 | global using Jil;
5 |
--------------------------------------------------------------------------------
/demo/Aoxe/Interfaces/ServiceAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Interfaces
4 | {
5 | public class ServiceAttribute : Attribute
6 | {
7 |
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Application/IntegrationEvent.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Application;
2 |
3 | public interface IIntegrationEvent { }
4 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Utf8Json/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using Aoxe.Client.Http.Formatter;
4 | global using Utf8Json;
5 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters/SerializeProcessor.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters;
2 |
3 | public class SerializeProcessor { }
4 |
--------------------------------------------------------------------------------
/demo/Aoxe.AspNetCore.Formatters.Demo/TestEnum.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Demo;
2 |
3 | public enum TestEnum
4 | {
5 | Apple,
6 | Banana,
7 | Pear
8 | }
9 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Domain/ValueObjects/Gender.cs:
--------------------------------------------------------------------------------
1 | namespace Domain.ValueObjects
2 | {
3 | public enum Gender
4 | {
5 | Male,
6 | Female
7 | }
8 | }
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/AliceServices/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using System;
4 | global using Interfaces;
5 | global using Microsoft.AspNetCore.Mvc;
6 |
--------------------------------------------------------------------------------
/demo/Aoxe/Interfaces/Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AoxeTech/Aoxe/HEAD/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_01.png
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AoxeTech/Aoxe/HEAD/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_03.png
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AoxeTech/Aoxe/HEAD/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_04.png
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AoxeTech/Aoxe/HEAD/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/images/Richardson_tAGP_05.png
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/Model/Model.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/Command.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface ICommand : IValueObject { }
4 |
5 | public abstract record Command : ICommand;
6 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/ValueObject.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IValueObject { }
4 |
5 | public abstract record ValueObject : IValueObject;
6 |
--------------------------------------------------------------------------------
/demo/Aoxe.AspNetCore.Formatters.Demo/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/DomainService.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IDomainService { }
4 |
5 | public class DomainServiceAttribute : Attribute { }
6 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.Threading.Tasks;
4 | global using Aoxe.DDD.Abstractions.Domain;
5 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier.Abstractions/DataAccess/DataAccessLayer.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier.Abstractions.DataAccess;
2 |
3 | public interface IDal { }
4 |
5 | public class DalAttribute : Attribute { }
6 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier.Abstractions/BusinessLogic/BusinessLogicLayer.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier.Abstractions.BusinessLogic;
2 |
3 | public interface IBll { }
4 |
5 | public class BllAttribute : Attribute { }
6 |
--------------------------------------------------------------------------------
/demo/Aoxe.AspNetCore.Formatters.Demo/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Application/ApplicationService.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Application;
2 |
3 | public interface IApplicationService { }
4 |
5 | public class ApplicationServiceAttribute : Attribute { }
6 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/demo/Aoxe/CarolHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/BusinessLogicLayer/Dtos/LoginRequestParam.cs:
--------------------------------------------------------------------------------
1 | namespace BusinessLogicLayer.Dtos
2 | {
3 | public class LoginRequestParam
4 | {
5 | public string Name { get; set; }
6 | public string Pwd { get; set; }
7 | }
8 | }
--------------------------------------------------------------------------------
/src/Aoxe.Shared/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.IO;
4 | global using System.Linq;
5 | global using System.Reflection;
6 | global using Microsoft.Extensions.DependencyInjection;
7 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/IAliceServices/Apple.cs:
--------------------------------------------------------------------------------
1 | namespace IAliceServices
2 | {
3 | public class Apple
4 | {
5 | public int Id { get; set; }
6 | public string Name { get; set; }
7 | public string Message { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/demo/Aoxe/Interfaces/IConsumer.cs:
--------------------------------------------------------------------------------
1 | namespace Interfaces
2 | {
3 | public interface IConsumer
4 | {
5 | }
6 |
7 | public interface IConsumer : IConsumer
8 | {
9 | void Consume(TMessage message);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Aoxe.Shared;
2 | global using Aoxe.ThreeTier.Abstractions.BusinessLogic;
3 | global using Aoxe.ThreeTier.Abstractions.DataAccess;
4 | global using Microsoft.Extensions.DependencyInjection;
5 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/ServiceHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/demo/Aoxe/CarolHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/src/Aoxe.Shared/TypePair.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Shared;
2 |
3 | public class TypePair(Type interfaceType, Type implementationType)
4 | {
5 | public Type? InterfaceType { get; } = interfaceType;
6 | public Type ImplementationType { get; } = implementationType;
7 | }
8 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/Factory.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IFactory { }
4 |
5 | public interface IFactory : IFactory
6 | where TEntity : IEntity { }
7 |
8 | public class FactoryAttribute : Attribute { }
9 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/BusinessLogicLayer/Dtos/CreateUserDto.cs:
--------------------------------------------------------------------------------
1 | namespace BusinessLogicLayer.Dtos
2 | {
3 | public class CreateUserDto
4 | {
5 | public string Name { get; set; }
6 | public string Pwd { get; set; }
7 | public string Nickname { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Aoxe.Core/AoxeMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Core;
2 |
3 | public abstract record AoxeMessage
4 | {
5 | public Guid Id { get; protected set; }
6 | public string MessageType { get; protected set; } = string.Empty;
7 | public string Content { get; protected set; } = string.Empty;
8 | }
9 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Infrastructure/Messaging/IMessageBus.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Infrastructure.Messaging;
2 |
3 | public interface IMessageBus
4 | {
5 | void Publish(string topic, T message);
6 | ValueTask PublishAsync(string topic, T message);
7 | }
8 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD/DomainEventSubscriber.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD;
2 |
3 | public class DomainEventSubscriber : BackgroundService
4 | {
5 | protected override Task ExecuteAsync(CancellationToken stoppingToken)
6 | {
7 | throw new NotImplementedException();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.MsgPack/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using Microsoft.AspNetCore.Mvc;
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Primitives;
5 | global using Microsoft.Net.Http.Headers;
6 |
--------------------------------------------------------------------------------
/src/Aoxe/AoxeHost.Extensions.DDD.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe;
2 |
3 | public static partial class AoxeHostExtensions
4 | {
5 | public static AoxeHost AddDDD(this AoxeHost aoxeHost)
6 | {
7 | aoxeHost.ConfigureServices(services => services.AddDDD());
8 | return aoxeHost;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Formatter/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Net.Http;
3 | global using System.Net.Http.Headers;
4 | global using System.Text;
5 | global using System.Threading.Tasks;
6 | global using Aoxe.Core;
7 | global using Aoxe.Serializer.Abstractions;
8 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Protobuf/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using Microsoft.AspNetCore.Mvc;
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Primitives;
5 | global using Microsoft.Net.Http.Headers;
6 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.ZeroFormatter/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using Microsoft.AspNetCore.Mvc;
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Primitives;
5 | global using Microsoft.Net.Http.Headers;
6 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/QueryService/Models/UserReadModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace QueryService.Models
4 | {
5 | public class UserReadModel
6 | {
7 | public Guid Id { get; set; }
8 | public string Name { get; set; }
9 | public int Age { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Jil/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using Jil;
3 | global using Microsoft.AspNetCore.Mvc;
4 | global using Microsoft.Extensions.DependencyInjection;
5 | global using Microsoft.Extensions.Primitives;
6 | global using Microsoft.Net.Http.Headers;
7 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/AliceServices/NonContractService.cs:
--------------------------------------------------------------------------------
1 | namespace AliceServices
2 | {
3 | public class NonContractService : IService
4 | {
5 | public string NonInterfaceTest()
6 | {
7 | return $"This has not implemented any interface.[{DateTime.UtcNow}]";
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Aoxe/AoxeHost.Extensions.ThreeTies.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe;
2 |
3 | public static partial class AoxeHostExtensions
4 | {
5 | public static AoxeHost AddThreeTiers(this AoxeHost aoxeHost)
6 | {
7 | aoxeHost.ConfigureServices(services => services.AddThreeTier());
8 | return aoxeHost;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Server/Grpc/Aoxe.Grpc/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using System.Collections.Concurrent;
4 | global using System.Reflection;
5 | global using System.Reflection.Emit;
6 | global using System.ServiceModel;
7 | global using Microsoft.Extensions.DependencyInjection;
8 | global using ProtoBuf.Grpc.Server;
9 |
--------------------------------------------------------------------------------
/demo/Aoxe.AspNetCore.Formatters.Demo/Controllers/ValuesController.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Demo.Controllers;
2 |
3 | [Route("api/[controller]/[action]")]
4 | public class ValuesController : ControllerBase
5 | {
6 | [HttpPost]
7 | public IEnumerable Post([FromBody] IEnumerable dtos) => dtos;
8 | }
9 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier/Aoxe.IServiceCollection.Extensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddThreeTier(this IServiceCollection services) =>
6 | services.AddBll().AddMessageHandler().AddDal();
7 | }
8 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Utf8Json/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using Microsoft.AspNetCore.Mvc;
3 | global using Microsoft.Extensions.DependencyInjection;
4 | global using Microsoft.Extensions.Primitives;
5 | global using Microsoft.Net.Http.Headers;
6 | global using Utf8Json;
7 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Application/Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.IO;
3 | global using System.Text;
4 | global using System.Threading;
5 | global using Aoxe.Serializer.Abstractions;
6 | global using Microsoft.AspNetCore.Mvc.Formatters;
7 | global using Microsoft.Net.Http.Headers;
8 |
--------------------------------------------------------------------------------
/demo/Aoxe/BobSystem/IBobServices/IBobServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/QueryService/QueryService.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/IAliceServices/IAliceServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/demo/Aoxe/CarolSystem/ICarolServices/ICarolServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/ServiceHost/Program.cs:
--------------------------------------------------------------------------------
1 | namespace ServiceHost;
2 |
3 | public class Program
4 | {
5 | public static void Main(string[] args)
6 | {
7 | Host.CreateDefaultBuilder(args)
8 | .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); })
9 | .Build().Run();
10 | }
11 | }
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/AliceServices/RouteAttributeService.cs:
--------------------------------------------------------------------------------
1 | namespace AliceServices;
2 |
3 | [Route("RouteTest/[action]")]
4 | [ServiceAttribute]
5 | public class RouteAttributeService
6 | {
7 | public string RouteAttributeTest()
8 | {
9 | return $"This has not implemented any interface.[{DateTime.UtcNow}]";
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/demo/Aoxe/CarolSystem/ICarolServices/ICarolService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Interfaces;
3 |
4 | namespace ICarolServices
5 | {
6 | public interface ICarolService : IService
7 | {
8 | string Hello();
9 | string SayHelloToAlice();
10 | string SayHelloToCarol();
11 | Exception ThrowException();
12 | }
13 | }
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/Model/User.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Model
4 | {
5 | public class User
6 | {
7 | public Guid Id { get; set; }
8 | public string Name { get; set; }
9 | public string Pwd { get; set; }
10 | public string Nickname { get; set; }
11 | public DateTime CreatedUtcTime { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.AutoSubscribe/Aoxe.AutoSubscribe.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/ServiceHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*",
10 | "PgSqlPrimary": "Host=192.168.78.140;Username=postgres;Password=postgres;Database=postgres"
11 | }
12 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*",
10 | "PgSqlStandby": "Host=192.168.78.141;Username=postgres;Password=postgres;Database=postgres"
11 | }
12 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceHost/Controllers/HealthCheck.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 |
3 | namespace AliceHost.Controllers
4 | {
5 | [Route("[Controller]")]
6 | public class HealthCheckController : Controller
7 | {
8 | [HttpGet("")]
9 | [HttpHead("")]
10 | public IActionResult Get()
11 | {
12 | return Ok();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/Program.cs:
--------------------------------------------------------------------------------
1 | namespace WebApiHost;
2 |
3 | public class Program
4 | {
5 | public static void Main(string[] args) =>
6 | Host.CreateDefaultBuilder(args)
7 | .ConfigureWebHostDefaults(webBuilder =>
8 | {
9 | webBuilder.UseStartup();
10 | })
11 | .Build()
12 | .Run();
13 | }
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Local/Aoxe.PubSub.Local.MediatR/Aoxe.PubSub.Local.MediatR.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/README.md:
--------------------------------------------------------------------------------
1 | # 微服务分层
2 |
3 | ---
4 |
5 | * 领域层(Domain)不依赖其它任何层,需要的功能直接在自己内部通过interface定义。
6 | * 应用层(Application)依赖领域层,并负责工作单元(UOW)的提交。
7 | * 仓储层(Repository)依赖领域层,并实现领域层中的仓储接口。
8 | * Host依赖应用层和仓储层,并负责IOC的注册:
9 | * 领域层:领域服务、领域事件订阅者。
10 | * 应用层:应用服务、应用事件订阅者。
11 | * 仓储层:将仓储实现注册为领域层中的仓储interface,并依据技术选型注册db connection。
12 | * 基础设施:将实现注册为interface,要依据实现的需要选择对应的生命周期。
13 |
14 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/ServiceCollectionExtension.cs:
--------------------------------------------------------------------------------
1 | namespace WebApiHost;
2 |
3 | public static class ServiceCollectionExtension
4 | {
5 | public static IServiceCollection AddDbConnection(this IServiceCollection services, string connectionString)
6 | {
7 | services.AddScoped(_ => new NpgsqlConnection(connectionString));
8 | return services;
9 | }
10 | }
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*",
10 | "ConnectionStrings": {
11 | "PgSql": "Host=192.168.78.140;Username=postgres;Password=postgres;Database=ThreeTier"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/AggregateRoot.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IAggregateRoot : IEntity { }
4 |
5 | public interface IAggregateRoot : IEntity, IAggregateRoot { }
6 |
7 | public abstract class AggregateRoot : Entity, IAggregateRoot { }
8 |
9 | public abstract class AggregateRoot : Entity, IAggregateRoot { }
10 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Local/Aoxe.PubSub.Local.Abstractions/Aoxe.PubSub.Local.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Local/Aoxe.PubSub.Local.MessagePipe/Aoxe.PubSub.Local.MessagePipe.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/QueryService/README.md:
--------------------------------------------------------------------------------
1 | # QueryService
2 |
3 | ---
4 |
5 | ## 说明
6 |
7 | * 在微服务级别的CQS中Q端的实现。
8 | * 当前QueryService为一个类库,实际上依据团队规模和开发成本,QueryService可以作为一个单独的微服务而部署。
9 | * CQS中,Q端并不属于OO的范畴,因此使用恰当(技术、成本、资源)的实现即可。
10 | * CQRS中,Q端的读模型实际上也相当于聚合的一种,其提供的接口也可使用**聚合即资源**的restful风格。
11 | * 当前示例使用了ADO.Net,实际操作中可使用ef的dbfirst模式(ef core已取消)、micro orm(如dapper、freesql等)或者一些lambda to sql的封装来实现。
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.Kafka/Aoxe.PubSub.Distributed.Kafka.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.NATS/Aoxe.PubSub.Distributed.NATS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.ZeroMQ/Aoxe.PubSub.Distributed.ZeroMQ.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.RabbitMQ/Aoxe.PubSub.Distributed.RabbitMQ.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Scheduling/Aoxe.Quartz/Aoxe.Quartz.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier/Aoxe.IServiceCollection.Extensions.Dal.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddDal(this IServiceCollection services) =>
6 | services
7 | .Register(ServiceLifetime.Scoped)
8 | .Register(ServiceLifetime.Scoped);
9 | }
10 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.RedisStream/Aoxe.PubSub.Distributed.RedisStream.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.Distributed.Abstractions/Aoxe.PubSub.Distributed.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/Aoxe.AspNetCore.Formatters.Demo/Program.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Demo;
2 |
3 | public class Program
4 | {
5 | public static void Main(string[] args) =>
6 | Host.CreateDefaultBuilder(args)
7 | .ConfigureWebHostDefaults(webBuilder =>
8 | {
9 | webBuilder.UseStartup();
10 | })
11 | .Build()
12 | .Run();
13 | }
14 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD/Aoxe.IServiceCollection.Extensions.Repository.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddRepository(this IServiceCollection services) =>
6 | services
7 | .Register(ServiceLifetime.Scoped)
8 | .Register(ServiceLifetime.Scoped);
9 | }
10 |
--------------------------------------------------------------------------------
/src/Server/Grpc/Aoxe.Grpc/Aoxe.Grpc.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Aoxe.Core/AoxeError.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Core;
2 |
3 | public class AoxeError
4 | {
5 | public Guid Id { get; set; }
6 | public string Code { get; set; } = string.Empty;
7 | public DateTime ThrowTime { get; set; } = DateTime.UtcNow;
8 | public string Message { get; set; } = string.Empty;
9 | public string Source { get; set; } = string.Empty;
10 | public string StackTrace { get; set; } = string.Empty;
11 | }
12 |
--------------------------------------------------------------------------------
/src/Aoxe.Shared/Aoxe.IServiceCollection.Extensions.LoadByDirectories.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Shared;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection FromDirectoriesOf(
6 | this IServiceCollection services,
7 | params string[] directories
8 | )
9 | {
10 | LoadHelper.FromDirectories(directories);
11 | return services;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Client/Grpc/Aoxe.Client.Grpc/Aoxe.Client.Grpc.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Aoxe/AoxeHost.Extensions.UnitOfWork.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe;
2 |
3 | public static partial class AoxeHostExtensions
4 | {
5 | public static AoxeHost AddAoxeUnitOfWork(
6 | this AoxeHost aoxeHost,
7 | Func factory
8 | )
9 | {
10 | aoxeHost.AddScoped(factory);
11 | aoxeHost.Configure(app => app.UseAoxeUnitOfWork());
12 | return aoxeHost;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/PubSub/Aoxe.PubSub.Distributed/Aoxe.PubSub.LocalMessageStorage.EntityFramework/Aoxe.PubSub.LocalMessageStorage.EntityFramework.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latestmajor
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi/Aoxe.IServiceCollection.Extensions.UnitOfWork.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.WebApi;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddUnitOfWork(
6 | this IServiceCollection services,
7 | Func factory
8 | )
9 | {
10 | services.AddScoped(factory);
11 | return services;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demo/Aoxe/CarolHost/Program.cs:
--------------------------------------------------------------------------------
1 | namespace CarolHost;
2 |
3 | public class Program
4 | {
5 | public static void Main(string[] args) =>
6 | Host.CreateDefaultBuilder(args)
7 | .ConfigureWebHostDefaults(webBuilder =>
8 | {
9 | webBuilder.UseStartup();
10 | webBuilder.UseUrls("http://localhost:5003");
11 | })
12 | .Build()
13 | .Run();
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Aoxe.AspNetCore.Formatters.Tests/GlobalUsing.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.Net.Http;
4 | global using System.Text;
5 | global using System.Threading.Tasks;
6 | global using Aoxe.AspNetCore.Formatters.Demo;
7 | global using Aoxe.Serializer.Abstractions;
8 | global using Jil;
9 | global using Microsoft.AspNetCore.Hosting;
10 | global using Microsoft.AspNetCore.TestHost;
11 | global using Xunit;
12 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier.Abstractions/BusinessLogic/MessageHandler.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier.Abstractions.BusinessLogic;
2 |
3 | public interface IMessageHandler { }
4 |
5 | public interface IMessageHandler : IMessageHandler
6 | {
7 | void Handle(TMessage message);
8 | }
9 |
10 | public class MessageHandlerAttribute(string handleName) : Attribute
11 | {
12 | public string HandleName { get; } = handleName.Trim();
13 | }
14 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/ServiceHost/UowMiddleware.cs:
--------------------------------------------------------------------------------
1 | namespace ServiceHost;
2 |
3 | public class UowMiddleware
4 | {
5 | private readonly RequestDelegate _next;
6 |
7 | public UowMiddleware(RequestDelegate next)
8 | {
9 | _next = next;
10 | }
11 |
12 | public async Task Invoke(HttpContext context, AoxeDddContext dbContext)
13 | {
14 | await _next(context);
15 | await dbContext.SaveChangesAsync();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Formatter/AoxeClientFormatterOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Formatter;
2 |
3 | public class AoxeClientFormatterOptions
4 | {
5 | public string MediaType { get; set; }
6 | public IStreamSerializer Serializer { get; set; }
7 |
8 | public AoxeClientFormatterOptions(IStreamSerializer serializer, string mediaType)
9 | {
10 | Serializer = serializer;
11 | MediaType = mediaType;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/BusinessLogicLayer/BusinessLogicLayer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/Scheduling/Aoxe.Hangfire/Aoxe.Hangfire.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Domain/IRepositories/IUserRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using Aoxe.DDD.Abstractions.Infrastructure.Repository;
5 | using Domain.AggregateRoots;
6 |
7 | namespace Domain.IRepositories
8 | {
9 | public interface IUserRepository : IRepository
10 | {
11 | Task AddAsync(User user);
12 | Task GetAsync(Guid id);
13 | Task> GetAllAsync();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceHost/Program.cs:
--------------------------------------------------------------------------------
1 | namespace AliceHost;
2 |
3 | public class Program
4 | {
5 | public static void Main(string[] args)
6 | {
7 | var builder = Host.CreateDefaultBuilder(args);
8 | builder
9 | .ConfigureWebHostDefaults(webBuilder =>
10 | {
11 | webBuilder.UseStartup();
12 | webBuilder.UseUrls("http://localhost:5001");
13 | })
14 | .Build()
15 | .Run();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Repository/Repository.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Infrastructure/Repository/Repository.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Infrastructure.Repository;
2 |
3 | public interface IRepository { }
4 |
5 | public interface IRepository : IRepository
6 | where TAggregateRoot : IAggregateRoot { }
7 |
8 | public interface IRepository : IRepository
9 | where TAggregateRoot : IAggregateRoot { }
10 |
11 | public class RepositoryAttribute : Attribute { }
12 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Domain/Domain.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System.Data;
2 | global using Aoxe.ThreeTier;
3 | global using Aoxe.ThreeTier.Abstractions.BusinessLogic;
4 | global using Aoxe.WebApi;
5 | global using Microsoft.AspNetCore.Builder;
6 | global using Microsoft.AspNetCore.Hosting;
7 | global using Microsoft.Extensions.Configuration;
8 | global using Microsoft.Extensions.DependencyInjection;
9 | global using Microsoft.Extensions.Hosting;
10 | global using Microsoft.OpenApi.Models;
11 | global using Npgsql;
12 |
--------------------------------------------------------------------------------
/src/Client/Http/Aoxe.Client.Http/Internal/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Internal;
2 |
3 | internal static class StringExtensions
4 | {
5 | internal static string TrimEnd(this string target, string trimString)
6 | {
7 | if (string.IsNullOrEmpty(trimString))
8 | return target;
9 |
10 | var result = target;
11 | while (result.EndsWith(trimString))
12 | result = result[..^trimString.Length];
13 |
14 | return result;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Client/Http/Aoxe.Client.Http/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.Linq;
4 | global using System.Net;
5 | global using System.Net.Http;
6 | global using System.Reflection;
7 | global using System.Threading;
8 | global using System.Threading.Tasks;
9 | global using Aoxe.Client.Http.Formatter;
10 | global using Aoxe.Client.Http.Internal;
11 | global using Aoxe.Core;
12 | global using Aoxe.Shared;
13 | global using Microsoft.Extensions.DependencyInjection;
14 |
--------------------------------------------------------------------------------
/src/Aoxe/AoxeHost.Extensions.Client.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe;
2 |
3 | public static partial class AoxeHostExtensions
4 | {
5 | public static AoxeHost UseAoxeClient(
6 | this AoxeHost aoxeHost,
7 | Type serviceDefineType,
8 | Dictionary configUrls,
9 | Action? optionsFactory = null
10 | ) =>
11 | aoxeHost.ConfigureServices(
12 | services => services.AddAoxeClient(serviceDefineType, configUrls, optionsFactory)
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/demo/Aoxe/BobSystem/IBobServices/IBobService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Interfaces;
4 |
5 | namespace IBobServices
6 | {
7 | public interface IBobService : IService
8 | {
9 | string Hello();
10 | Task HelloAsyncTest();
11 | string SayHelloToAlice();
12 | Task SayHelloToAliceAsyncTest();
13 | string SayHelloToCarol();
14 | Exception ThrowException();
15 | Task PassAppleToAliceAsync(string appleName);
16 | }
17 | }
--------------------------------------------------------------------------------
/demo/Aoxe/CarolSystem/CarolServices/CarolServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Domain/Entities/Card.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Aoxe.DDD.Abstractions.Domain;
3 |
4 | namespace Domain.Entities
5 | {
6 | public class Card : Entity
7 | {
8 | public Guid Id { get; protected set; }
9 | public string Name { get; protected set; }
10 |
11 | public Card(Guid id, string name)
12 | {
13 | if (id == Guid.Empty)
14 | throw new ArgumentNullException(nameof(id));
15 | (Id, Name) = (id, name);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/DataAccessLayer/DataAccessLayer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Aoxe.Core/AoxeException.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Core;
2 |
3 | public class AoxeException : Exception
4 | {
5 | public Guid Id { get; set; } = Guid.NewGuid();
6 | public string Code { get; set; } = string.Empty;
7 | public DateTime ThrowTime { get; set; } = DateTime.UtcNow;
8 |
9 | public AoxeException() { }
10 |
11 | public AoxeException(string message)
12 | : base(message) { }
13 |
14 | public AoxeException(string message, Exception innerException)
15 | : base(message, innerException) { }
16 | }
17 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Domain/ValueObjects/Address.cs:
--------------------------------------------------------------------------------
1 | namespace Domain.ValueObjects
2 | {
3 | public record Address
4 | {
5 | public string Country { get; protected set; }
6 | public string State { get; protected set; }
7 | public string City { get; protected set; }
8 | public string Street { get; protected set; }
9 |
10 | public Address(string country, string state, string city, string street) =>
11 | (Country, State, City, Street) = (country, state, city, street);
12 | }
13 | }
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD/Aoxe.IServiceCollection.Extensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddDDD(this IServiceCollection services) =>
6 | services
7 | .AddApplicationService()
8 | .AddIntegrationEventHandler()
9 | .AddDomainService()
10 | .AddDomainEventHandler()
11 | .AddDomainFactory()
12 | .AddRepository()
13 | .AddDomainEventPublisher();
14 | }
15 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/IAliceServices/IAliceService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Interfaces;
4 |
5 | namespace IAliceServices
6 | {
7 | public interface IAliceService : IService
8 | {
9 | string Hello();
10 | string SayHelloToBob();
11 | string SayHellosToBob(int quantity);
12 | Task SayHelloToBobAsyncTest();
13 | string SayHelloToCarol();
14 | Exception ThrowException();
15 | Task PassBackAppleAsync(Apple apple);
16 | Task HelloAsyncTest();
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.MsgPack/AoxeClientFormatterOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.MsgPack;
2 |
3 | public static class AoxeClientFormatterOptionsExtensions
4 | {
5 | public static AoxeClientFormatterOptions UseMsgPackFormatter(
6 | this AoxeClientFormatterOptions formatterOptions,
7 | string mediaType = "application/x-msgpack"
8 | )
9 | {
10 | formatterOptions.Serializer = new Aoxe.MsgPack.Serializer();
11 | formatterOptions.MediaType = mediaType;
12 | return formatterOptions;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demo/Aoxe/AliceSystem/AliceServices/AliceServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | Library
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Protobuf/AoxeClientFormatterOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Protobuf;
2 |
3 | public static class AoxeClientFormatterOptionsExtensions
4 | {
5 | public static AoxeClientFormatterOptions UseProtobufFormatter(
6 | this AoxeClientFormatterOptions formatterOptions,
7 | string mediaType = "application/x-protobuf"
8 | )
9 | {
10 | formatterOptions.Serializer = new Aoxe.Protobuf.Serializer();
11 | formatterOptions.MediaType = mediaType;
12 | return formatterOptions;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/BackendForBrowser/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Hosting;
3 |
4 | namespace BackendForBrowser
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | CreateHostBuilder(args).Build().Run();
11 | }
12 |
13 | public static IHostBuilder CreateHostBuilder(string[] args) =>
14 | Host.CreateDefaultBuilder(args)
15 | .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); });
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/DomainEventHandler.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IDomainEventHandler { }
4 |
5 | public interface IDomainEventHandler : IDomainEventHandler
6 | where TDomainEvent : IDomainEvent
7 | {
8 | void Handle(TDomainEvent domainEvent);
9 | }
10 |
11 | public class DomainEventHandlerAttribute : Attribute
12 | {
13 | public string HandleName { get; }
14 |
15 | public DomainEventHandlerAttribute(string handleName)
16 | {
17 | HandleName = handleName.Trim();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Zeroformatter/AoxeClientFormatterOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Zeroformatter;
2 |
3 | public static class AoxeClientFormatterOptionsExtensions
4 | {
5 | public static AoxeClientFormatterOptions UseZeroFormatter(
6 | this AoxeClientFormatterOptions formatterOptions,
7 | string mediaType = "application/x-zeroformatter"
8 | )
9 | {
10 | formatterOptions.Serializer = new ZeroFormatter.Serializer();
11 | formatterOptions.MediaType = mediaType;
12 | return formatterOptions;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi/UnitOfWorkMiddleware.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.WebApi;
2 |
3 | public class UnitOfWorkMiddleware
4 | {
5 | private readonly RequestDelegate _next;
6 |
7 | public UnitOfWorkMiddleware(RequestDelegate next) => _next = next;
8 |
9 | public async Task Invoke(HttpContext context, IDbTransaction dbTransaction)
10 | {
11 | await _next(context);
12 | try
13 | {
14 | dbTransaction.Commit();
15 | }
16 | catch
17 | {
18 | dbTransaction.Rollback();
19 | throw;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Application/README.md:
--------------------------------------------------------------------------------
1 | # 应用层
2 |
3 | ---
4 |
5 | ## 构成
6 |
7 | * 应用服务
8 | * 集成事件订阅者
9 | * 集成事件发布者
10 |
11 | ## 说明
12 |
13 | * 应用层作为界限上下文(Bounded context)的皮肤,是很薄的一层,本身不存在任何的业务逻辑。
14 | * 每一个应用服务的方法都是一个用例(use case),所以一个请求对应一个方法。
15 | * 集成事件源自领域事件,当领域事件需要发布到微服务之外,则在应用层实现一个领域事件处理者,将其转换为集成事件再发布出去。
16 | * 应用层同时负责订阅外界的集成事件,但应用服务和集成事件订阅者不过是触发方式(请求响应/发布订阅)的不同,它们要遵守的原则实际上差不多。
17 | * **注意**:因为每个应用服务的方法都对应一个用例,因此同一个界限上下文中的应用服务不应该存在相互调用的情况,因为:
18 | 1. 如果存在相互调用,则随着系统的迭代最终会让应用服务层形成一个网状依赖的结构,从而提高了维护成本。
19 | 2. 应用服务间存在相互调用,代表着用例的复用,这不仅是破坏了用例的定义,某种程度上还相当于将业务逻辑泄露到应用层,因为这导致应用层中存在对业务逻辑的编排。
20 |
21 |
--------------------------------------------------------------------------------
/src/Aoxe.Core/AoxeUnpublishedMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Core;
2 |
3 | public record AoxeUnpublishedMessage : AoxeMessage
4 | {
5 | public DateTime PersistenceUtcTime { get; protected set; } = DateTime.UtcNow;
6 |
7 | private AoxeUnpublishedMessage() { }
8 |
9 | public AoxeUnpublishedMessage(
10 | Guid id,
11 | string messageType,
12 | string content,
13 | DateTime persistenceUtcTime
14 | )
15 | {
16 | Id = id;
17 | MessageType = messageType;
18 | Content = content;
19 | PersistenceUtcTime = persistenceUtcTime;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Jil/AoxeClientFormatterOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Jil;
2 |
3 | public static class AoxeClientFormatterOptionsExtensions
4 | {
5 | public static AoxeClientFormatterOptions UseJilFormatter(
6 | this AoxeClientFormatterOptions formatterOptions,
7 | string mediaType = "application/x-jil",
8 | Options? jilOptions = null
9 | )
10 | {
11 | formatterOptions.Serializer = new Aoxe.Jil.Serializer(jilOptions);
12 | formatterOptions.MediaType = mediaType;
13 | return formatterOptions;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Aoxe.AspNetCore.Formatters.Tests/MsgPack.Formatter.Test.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Tests;
2 |
3 | public partial class FormatterTest
4 | {
5 | [Fact]
6 | public async Task MsgPackFormatterTest()
7 | {
8 | var serializer = new Aoxe.MsgPack.Serializer();
9 | await StreamFormatterAsync(serializer, "application/x-msgpack");
10 | }
11 |
12 | [Fact]
13 | public async Task MsgPackFormatterNullTest()
14 | {
15 | var serializer = new Aoxe.MsgPack.Serializer();
16 | await StreamFormatterNullAsync(serializer, "application/x-msgpack");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi/AoxeAppServiceControllerFeatureProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.WebApi;
2 |
3 | internal class AoxeAppServiceControllerFeatureProvider
4 | : IApplicationFeatureProvider
5 | {
6 | private readonly List _implementTypes;
7 |
8 | public AoxeAppServiceControllerFeatureProvider(List implementTypes) =>
9 | _implementTypes = implementTypes;
10 |
11 | public void PopulateFeature(IEnumerable parts, ControllerFeature feature) =>
12 | _implementTypes.ForEach(serviceType => feature.Controllers.Add(serviceType.GetTypeInfo()));
13 | }
14 |
--------------------------------------------------------------------------------
/tests/Aoxe.AspNetCore.Formatters.Tests/Utf8Json.Formatter.Test.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Tests;
2 |
3 | public partial class FormatterTest
4 | {
5 | [Fact]
6 | public async Task Utf8JsonFormatterTest()
7 | {
8 | var serializer = new Aoxe.Utf8Json.Serializer();
9 | await TextFormatterAsync(serializer, "application/x-utf8json");
10 | }
11 |
12 | [Fact]
13 | public async Task Utf8JsonFormatterNullTest()
14 | {
15 | var serializer = new Aoxe.Utf8Json.Serializer();
16 | await TextFormatterNullAsync(serializer, "application/x-utf8json");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/ConsoleHost/ConsoleHost.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | latest
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/Aoxe.AspNetCore.Formatters.Tests/Protobuf.Formatter.Test.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Tests;
2 |
3 | public partial class FormatterTest
4 | {
5 | [Fact]
6 | public async Task ProtobufFormatterTest()
7 | {
8 | var serializer = new Aoxe.Protobuf.Serializer();
9 | await StreamFormatterAsync(serializer, "application/x-protobuf");
10 | }
11 |
12 | [Fact]
13 | public async Task ProtobufFormatterNullTest()
14 | {
15 | var serializer = new Aoxe.Protobuf.Serializer();
16 | await StreamFormatterNullAsync(serializer, "application/x-protobuf");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Aoxe.AspNetCore.Formatters.Tests/ZeroFormatter.Formatter.Test.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Tests;
2 |
3 | public partial class FormatterTest
4 | {
5 | [Fact]
6 | public async Task ZeroFormatterTest()
7 | {
8 | var serializer = new Aoxe.ZeroFormatter.Serializer();
9 | await StreamFormatterAsync(serializer, "application/x-zeroformatter");
10 | }
11 |
12 | [Fact]
13 | public async Task ZeroFormatterNullTest()
14 | {
15 | var serializer = new Aoxe.ZeroFormatter.Serializer();
16 | await StreamFormatterNullAsync(serializer, "application/x-zeroformatter");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/demo/Aoxe/BobSystem/BobServices/BobServices.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Aoxe
2 |
3 | A micro service framework base by asp.net core.
4 |
5 | [Aoxe.DDD](https://github.com/AoxeTech/Aoxe/tree/master/src/DDD)
6 |
7 | [Aoxe.ThreeTier](https://github.com/AoxeTech/Aoxe/tree/master/src/ThreeTier)
8 |
9 | Thank`s for [JetBrains](https://www.jetbrains.com/) for the great support in providing assistance and user-friendly environment for my open source projects.
10 |
11 | [](https://www.jetbrains.com/community/opensource/#support)
--------------------------------------------------------------------------------
/src/Aoxe/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.Data;
4 | global using System.Linq;
5 | global using System.Reflection;
6 | global using Aoxe.Client.Http;
7 | global using Aoxe.Client.Http.Formatter;
8 | global using Aoxe.DDD;
9 | global using Aoxe.Server;
10 | global using Aoxe.Shared;
11 | global using Aoxe.ThreeTier;
12 | global using Microsoft.AspNetCore.Builder;
13 | global using Microsoft.AspNetCore.Hosting;
14 | global using Microsoft.Extensions.DependencyInjection;
15 | global using Microsoft.Extensions.DependencyInjection.Extensions;
16 | global using Microsoft.Extensions.Hosting;
17 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Application/IntegrationEventHandler.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Application;
2 |
3 | public interface IIntegrationEventHandler { }
4 |
5 | public interface IIntegrationEventHandler : IIntegrationEventHandler
6 | where TIntegrationEvent : IIntegrationEvent
7 | {
8 | void Handle(TIntegrationEvent integrationEvent);
9 | }
10 |
11 | public class IntegrationEventHandlerAttribute : Attribute
12 | {
13 | public string HandleName { get; }
14 |
15 | public IntegrationEventHandlerAttribute(string handleName)
16 | {
17 | HandleName = handleName;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.MsgPack/README.md:
--------------------------------------------------------------------------------
1 | # Aoxe.AspNetCore.MsgPack
2 |
3 | Protobuf formatters for asp.net core
4 |
5 | ## QuickStart
6 |
7 | ### NuGet
8 |
9 | Install-Package Aoxe.AspNetCore.Formatters.MsgPack
10 |
11 | ### Build Project
12 |
13 | Create an asp.net core project and import reference in startup.cs
14 |
15 | ```CSharp
16 | using Aoxe.AspNetCore.Formatters.MsgPack;
17 | ```
18 |
19 | Modify the ConfigureServices like this
20 |
21 | ```CSharp
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddControllers()
25 | .AddMsgPack();
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Protobuf/README.md:
--------------------------------------------------------------------------------
1 | # Aoxe.AspNetCore.Protobuf
2 |
3 | Protobuf formatters for asp.net core
4 |
5 | ## QuickStart
6 |
7 | ### NuGet
8 |
9 | Install-Package Aoxe.AspNetCore.Formatters.Protobuf
10 |
11 | ### Build Project
12 |
13 | Create an asp.net core project and import reference in startup.cs
14 |
15 | ```CSharp
16 | using Aoxe.AspNetCore.Formatters.Protobuf;
17 | ```
18 |
19 | Modify the ConfigureServices like this
20 |
21 | ```CSharp
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddControllers()
25 | .AddProtobuf();
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Utf8Json/README.md:
--------------------------------------------------------------------------------
1 | # Aoxe.AspNetCore.Utf8Json
2 |
3 | Utf8Json formatters for asp.net core
4 |
5 | ## QuickStart
6 |
7 | ### NuGet
8 |
9 | Install-Package Aoxe.AspNetCore.Formatters.Utf8Json
10 |
11 | ### Build Project
12 |
13 | Create an asp.net core project and import reference in startup.cs
14 |
15 | ```CSharp
16 | using Aoxe.AspNetCore.Formatters.Utf8Json;
17 | ```
18 |
19 | Modify the ConfigureServices like this
20 |
21 | ```CSharp
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddControllers()
25 | .AddUtf8Json();
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/demo/Aoxe.ThreeTier/WebApiHost/WebApiHost.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Aoxe.Shared/LoadHelper.LoadByAssemblies.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Shared;
2 |
3 | public static partial class LoadHelper
4 | {
5 | public static void FromAssemblyNames(params AssemblyName[] assemblyNames) =>
6 | FromAssemblies(assemblyNames.Select(Assembly.Load).ToArray());
7 |
8 | public static void FromAssemblies(params Assembly[] assemblies)
9 | {
10 | SpecifyTypes.AddRange(
11 | assemblies
12 | .SelectMany(assembly => assembly.GetTypes())
13 | .Where(p => !SpecifyTypes.Contains(p))
14 | .Distinct()
15 | );
16 | LoadMode = LoadTypesMode.LoadBySpecify;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Utf8Json/AoxeClientFormatterOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Utf8Json;
2 |
3 | public static class AoxeClientFormatterOptionsExtensions
4 | {
5 | public static AoxeClientFormatterOptions UseUtf8JsonFormatter(
6 | this AoxeClientFormatterOptions formatterOptions,
7 | string mediaType = "application/x-utf8json",
8 | IJsonFormatterResolver? jsonFormatterResolver = null
9 | )
10 | {
11 | formatterOptions.Serializer = new Aoxe.Utf8Json.Serializer(jsonFormatterResolver);
12 | formatterOptions.MediaType = mediaType;
13 | return formatterOptions;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Architecture/ThreeTier/Aoxe.ThreeTier/Aoxe.IServiceCollection.Extensions.Bll.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.ThreeTier;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddBll(this IServiceCollection services) =>
6 | services
7 | .Register(ServiceLifetime.Scoped)
8 | .Register(ServiceLifetime.Scoped);
9 |
10 | public static IServiceCollection AddMessageHandler(this IServiceCollection services) =>
11 | services
12 | .Register(ServiceLifetime.Scoped)
13 | .Register(ServiceLifetime.Scoped);
14 | }
15 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/ServiceHost/ServiceCollectionExtension.cs:
--------------------------------------------------------------------------------
1 | namespace ServiceHost;
2 |
3 | public static class ServiceCollectionExtension
4 | {
5 | public static IServiceCollection AddDbContext(
6 | this IServiceCollection services,
7 | IConfiguration config
8 | )
9 | {
10 | //注册EF用于C端仓储层
11 | services.AddDbContext(
12 | options => options.UseNpgsql(config.GetSection("PgSqlPrimary").Get())
13 | );
14 | //使用上面已注册的pgsql上下文再次注册DbContext以用于框架内注入提交UOW
15 | services.AddScoped(p => p.GetService());
16 | return services;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.ZeroFormatter/README.md:
--------------------------------------------------------------------------------
1 | # Aoxe.AspNetCore.ZeroFormatter
2 |
3 | Protobuf formatters for asp.net core
4 |
5 | ## QuickStart
6 |
7 | ### NuGet
8 |
9 | Install-Package Aoxe.AspNetCore.Formatters.ZeroFormatter
10 |
11 | ### Build Project
12 |
13 | Create an asp.net core project and import reference in startup.cs
14 |
15 | ```CSharp
16 | using Aoxe.AspNetCore.Formatters.ZeroFormatter;
17 | ```
18 |
19 | Modify the ConfigureServices like this
20 |
21 | ```CSharp
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddControllers()
25 | .AddZeroFormatter();
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD.Abstractions/Domain/DomainEvent.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD.Abstractions.Domain;
2 |
3 | public interface IDomainEvent : IValueObject { }
4 |
5 | public interface IDomainEvent : IDomainEvent
6 | {
7 | TEntityId EntityId { get; }
8 | public int EntityVersion { get; }
9 | }
10 |
11 | public abstract record DomainEvent : IDomainEvent
12 | {
13 | public TEntityId EntityId { get; protected set; }
14 | public int EntityVersion { get; protected set; }
15 |
16 | protected DomainEvent(Entity entity)
17 | {
18 | EntityId = entity.Id;
19 | EntityVersion = entity.Version;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi/Aoxe.IApplicationBuilder.Extensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.WebApi;
2 |
3 | public static class AoxeIApplicationBuilderExtensions
4 | {
5 | public static IApplicationBuilder UseAoxe(this IApplicationBuilder app) =>
6 | app.UseAoxeErrorHandling()
7 | .UseRouting()
8 | .UseEndpoints(endpoints => endpoints.MapControllers());
9 |
10 | public static IApplicationBuilder UseAoxeErrorHandling(this IApplicationBuilder app) =>
11 | app.UseMiddleware();
12 |
13 | public static IApplicationBuilder UseAoxeUnitOfWork(this IApplicationBuilder app) =>
14 | app.UseMiddleware();
15 | }
16 |
--------------------------------------------------------------------------------
/src/Aoxe.Shared/Aoxe.IServiceCollection.Extensions.LoadByAssemblies.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Shared;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection FromAssemblyNames(
6 | this IServiceCollection services,
7 | params AssemblyName[] assemblyNames
8 | )
9 | {
10 | LoadHelper.FromAssemblyNames(assemblyNames);
11 | return services;
12 | }
13 |
14 | public static IServiceCollection FromAssemblies(
15 | this IServiceCollection services,
16 | params Assembly[] assemblies
17 | )
18 | {
19 | LoadHelper.FromAssemblies(assemblies);
20 | return services;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Aoxe.Core/AoxePublishedMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Core;
2 |
3 | public record AoxePublishedMessage : AoxeMessage
4 | {
5 | public DateTime PersistenceUtcTime { get; protected set; } = DateTime.UtcNow;
6 | public DateTime PublishedUtcTime { get; protected set; } = DateTime.UtcNow;
7 |
8 | private AoxePublishedMessage() { }
9 |
10 | public AoxePublishedMessage(AoxeUnpublishedMessage unpublishedMessage)
11 | {
12 | Id = unpublishedMessage.Id;
13 | MessageType = unpublishedMessage.MessageType;
14 | Content = unpublishedMessage.Content;
15 | PersistenceUtcTime = unpublishedMessage.PersistenceUtcTime;
16 | PublishedUtcTime = DateTime.UtcNow;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/demo/Aoxe/BobHost/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using System.Collections.Generic;
4 | global using Aoxe;
5 | global using Aoxe.AspNetCore.Formatters.Jil;
6 | global using Aoxe.AspNetCore.Formatters.MsgPack;
7 | global using Aoxe.AspNetCore.Formatters.Protobuf;
8 | global using Aoxe.AspNetCore.Formatters.Utf8Json;
9 | global using Aoxe.AspNetCore.Formatters.ZeroFormatter;
10 | global using Aoxe.Client.Http.MsgPack;
11 | global using Aoxe.Server;
12 | global using BobServices;
13 | global using IAliceServices;
14 | global using IBobServices;
15 | global using ICarolServices;
16 | global using Interfaces;
17 | global using Microsoft.AspNetCore.Builder;
18 | global using Microsoft.Extensions.DependencyInjection;
19 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD/Aoxe.IServiceCollection.Extensions.Application.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.DDD;
2 |
3 | public static partial class AoxeIServiceCollectionExtensions
4 | {
5 | public static IServiceCollection AddApplicationService(this IServiceCollection services) =>
6 | services
7 | .Register(ServiceLifetime.Scoped)
8 | .Register(ServiceLifetime.Scoped);
9 |
10 | public static IServiceCollection AddIntegrationEventHandler(this IServiceCollection services) =>
11 | services
12 | .Register(ServiceLifetime.Scoped)
13 | .Register(ServiceLifetime.Scoped);
14 | }
15 |
--------------------------------------------------------------------------------
/src/Architecture/DDD/Aoxe.DDD/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using System;
2 | global using System.Collections.Generic;
3 | global using System.Linq;
4 | global using System.Threading;
5 | global using System.Threading.Tasks;
6 | global using Aoxe.Core;
7 | global using Aoxe.DDD.Abstractions.Application;
8 | global using Aoxe.DDD.Abstractions.Domain;
9 | global using Aoxe.DDD.Abstractions.Infrastructure.Messaging;
10 | global using Aoxe.DDD.Abstractions.Infrastructure.Repository;
11 | global using Aoxe.SequentialGuid;
12 | global using Aoxe.Serializer.Abstractions;
13 | global using Aoxe.Shared;
14 | global using Microsoft.EntityFrameworkCore;
15 | global using Microsoft.Extensions.DependencyInjection;
16 | global using Microsoft.Extensions.Hosting;
17 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/BackendForFrontend/README.md:
--------------------------------------------------------------------------------
1 | # Frontend
2 |
3 | ---
4 |
5 | ## 说明
6 |
7 | * 此模块包含了BFF和QueryService,QueryService是一个被BFF依赖的类库。但在拓扑中,两者可以是单独的模块。
8 | * 此示例是通过BFF直接调用QueryService完成Q端功能,假如是独立的QueryService,其本身也可以是一个微服务,BFF通过GraphQL等技术手段进行远程调用。
9 | * 从团队组成的职责来说,BFF是由负责对应客户端的前端编写的(如Browser团队负责BFF-Browser,IOS团队负责BFF-IOS,Android团队负责BFF-Android),其主要职责在于:
10 |
11 | 1. 响应的格式化:前端要求后端响应能够满足特定的屏幕/显示适配。
12 | 2. 完成一个页面操作需要调用多次API所导致的性能问题:从面向对象设计来说,相当于一种外观模式,实际上是一种为客户端而设计的API网关。
13 | 3. **解决以数据库为中心的API设计**:restful风格不仅仅是一种风格,其最重要的概念在于对**资源**的定义和抽象,实际上**资源**就是DDD中的**聚合**。
14 | * 从团队组成的职责来说,QueryService由后端或者BI负责编写:
15 |
16 | 1. CQS:可以通过GraphQL等技术手段给予前端数据查询的功能。
17 | 2. CQRS:每类请求都可以抽象为一个读模型,而读模型本身也是聚合的一种,通过空间换时间的方式提供成本更高但性能和扩展性更强的数据输出手段(如报表)。
18 |
--------------------------------------------------------------------------------
/demo/Aoxe.DDD/MicroService/Repository/CustomDbContext.cs:
--------------------------------------------------------------------------------
1 | using Domain.AggregateRoots;
2 | using Microsoft.EntityFrameworkCore;
3 | using Repository.EntityConfigurations;
4 | using Aoxe.Serializer.Abstractions;
5 | using Aoxe.DDD;
6 |
7 | namespace Repository;
8 |
9 | public sealed class CustomDbContext : AoxeDddContext
10 | {
11 | public DbSet Users { get; set; }
12 |
13 | public CustomDbContext(DbContextOptions options, ITextSerializer serializer) : base(options,
14 | serializer)
15 | {
16 | Database.EnsureCreated();
17 | }
18 |
19 | protected override void OnModelCreating(ModelBuilder modelBuilder)
20 | {
21 | modelBuilder.ApplyConfiguration(new UserEntityTypeConfiguration());
22 | }
23 | }
--------------------------------------------------------------------------------
/src/Aoxe/AoxeHost.Extensions.HostService.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe;
2 |
3 | public partial class AoxeHost
4 | {
5 | public AoxeHost AddHostedService(AoxeHost aoxeHost)
6 | where THostedService : class, IHostedService
7 | {
8 | TryAddEnumerable(ServiceDescriptor.Singleton());
9 | return aoxeHost;
10 | }
11 |
12 | public AoxeHost AddHostedService(
13 | AoxeHost aoxeHost,
14 | Func implementationFactory
15 | )
16 | where THostedService : class, IHostedService
17 | {
18 | TryAddEnumerable(ServiceDescriptor.Singleton(implementationFactory));
19 | return aoxeHost;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Client/Http/Formatters/Aoxe.Client.Http.Formatter/AoxeHttpClientFormatterFactory.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Formatter;
2 |
3 | public static class AoxeHttpClientFormatterFactory
4 | {
5 | public static AoxeHttpClientFormatter Create(AoxeClientFormatterOptions options) =>
6 | options.Serializer switch
7 | {
8 | ITextSerializer => new AoxeHttpClientTextFormatter(options),
9 | not null => new AoxeHttpClientStreamFormatter(options),
10 | _
11 | => throw new ArgumentOutOfRangeException(
12 | nameof(options.Serializer),
13 | $"options.Serializer must be {nameof(ITextSerializer)} or {nameof(IStreamSerializer)}."
14 | )
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters/AoxeOutputFormatter.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters;
2 |
3 | public class AoxeOutputFormatter : OutputFormatter
4 | {
5 | private readonly IBytesSerializer _bytesSerializer;
6 |
7 | public AoxeOutputFormatter(MediaTypeHeaderValue contentType, IBytesSerializer bytesSerializer)
8 | {
9 | SupportedMediaTypes.Add(contentType);
10 | _bytesSerializer = bytesSerializer;
11 | }
12 |
13 | public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) =>
14 | await context
15 | .HttpContext
16 | .Response
17 | .BodyWriter
18 | .WriteAsync(_bytesSerializer.ToBytes(context.ObjectType!, context.Object));
19 | }
20 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.ZeroFormatter/MvcBuilderExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.ZeroFormatter;
2 |
3 | public static class MvcBuilderExtension
4 | {
5 | public static IMvcBuilder AddZeroFormatter(
6 | this IMvcBuilder mvcBuilder,
7 | string contentType = "application/x-zeroformatter",
8 | string format = "zeroformatter"
9 | )
10 | {
11 | if (string.IsNullOrWhiteSpace(contentType))
12 | throw new ArgumentNullException(nameof(contentType));
13 | if (string.IsNullOrWhiteSpace(format))
14 | throw new ArgumentNullException(nameof(format));
15 |
16 | return mvcBuilder.AddMvcOptions(options => options.AddZeroFormatter(contentType, format));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.MsgPack/MvcBuilderExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.MsgPack;
2 |
3 | public static class MvcBuilderExtension
4 | {
5 | public static IMvcBuilder AddMsgPack(
6 | this IMvcBuilder mvcBuilder,
7 | string contentType = "application/x-msgpack",
8 | string format = "msgpack"
9 | )
10 | {
11 | if (string.IsNullOrWhiteSpace(contentType))
12 | throw new ArgumentNullException(nameof(contentType));
13 | if (string.IsNullOrWhiteSpace(format))
14 | throw new ArgumentNullException(nameof(format));
15 |
16 | return mvcBuilder.AddMvcOptions(
17 | options => options.AddMsgPackFormatter(contentType, format)
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Server/WebApi/Aoxe.WebApi.Formatters/Aoxe.AspNetCore.Formatters.Protobuf/MvcBuilderExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.AspNetCore.Formatters.Protobuf;
2 |
3 | public static class MvcBuilderExtension
4 | {
5 | public static IMvcBuilder AddProtobuf(
6 | this IMvcBuilder mvcBuilder,
7 | string contentType = "application/x-protobuf",
8 | string format = "protobuf"
9 | )
10 | {
11 | if (string.IsNullOrWhiteSpace(contentType))
12 | throw new ArgumentNullException(nameof(contentType));
13 | if (string.IsNullOrWhiteSpace(format))
14 | throw new ArgumentNullException(nameof(format));
15 |
16 | return mvcBuilder.AddMvcOptions(
17 | options => options.AddProtobufFormatter(contentType, format)
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Client/Http/Aoxe.Client.Http/Internal/TaskExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Aoxe.Client.Http.Internal;
2 |
3 | internal static class TaskExtensions
4 | {
5 | internal static Task CastResult(this Task