├── .github └── workflows │ ├── deploy_all_demos.yml │ ├── deploy_gateway_ocelot.yml │ ├── nuget_infra.yml │ └── nuget_shared.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── doc ├── architecture │ ├── full.argr │ ├── full_archiecture_view.graphml │ ├── infra.argr │ ├── infra_architecture_view.graphml │ ├── serviceshared.argr │ └── serviceshared_archiecture_view.graphml ├── consul │ ├── consul-rg-adnc-sys.json │ ├── demo │ │ ├── admin-api-appsettings.json │ │ ├── cust-api-appsettings.json │ │ ├── gateway-appsettings.json │ │ ├── maint-api-appsettings.json │ │ └── shared.appsettings.json │ ├── fabio.properties │ ├── readme.md │ └── services.json ├── dbsql │ └── adnc.sql ├── docker │ ├── docker-compose-kong.yml │ ├── docker-registry.md │ ├── readme.md │ └── sw-compose.yml ├── dotmemory │ └── install_dotmemory_in_container.md ├── jenkins │ ├── Dockerfile │ ├── readme.md │ └── vue │ │ ├── .dockerignore │ │ ├── Dockerfile │ │ ├── stopcontainer.sh │ │ └── vue-adnc.conf ├── jmeter │ └── adnc.jmx ├── k8s │ ├── adnc-usr-webapi-rs.yaml │ └── adnc_usr_webapi.yaml ├── logo │ ├── ADNC_01.svg │ ├── ADNC_02.svg │ ├── ADNC_03.svg │ ├── ADNC_04.svg │ └── ADNC_05.png ├── loki │ ├── docker-compose.yml │ ├── loki.yml │ └── promtail.yml ├── mariadb │ ├── log_seting.md │ ├── order_of_execution_of_sql.md │ └── readme.md ├── maxscale │ ├── my.cnf │ └── readme.md ├── mongodb │ └── readme.md ├── mycat │ ├── Dockerfile │ ├── readme.md │ ├── schema.xml │ └── server.xml ├── redis │ └── redis.conf ├── sonarqube │ └── readme.md ├── utf-8 │ ├── utf-8-cs.bat │ ├── utf-8-csproj.bat │ ├── utf-8-json.bat │ └── utf-8-props.bat ├── wiki │ ├── 如何快速跑起来_v0.9.x.md │ ├── 如何快速跑起来_v1.0.md │ ├── 如何快速部署到容器_v0.9.x.md │ ├── 如何快速部署到容器_v1.0.md │ └── 配置文件详解_v1.0.md └── workflows │ └── docker-build-push.md ├── src ├── .dockerignore ├── .editorconfig ├── .gitattributes ├── Adnc.sln ├── Delete-BIN-OBJ-Folders.bat ├── Demo │ ├── Admin │ │ ├── Admin.Api │ │ │ ├── Adnc.Demo.Admin.Api.csproj │ │ │ ├── Authentication │ │ │ │ └── BearerAuthenticationLocalProcessor.cs │ │ │ ├── Authorization │ │ │ │ └── PermissionLocalHandler.cs │ │ │ ├── Controllers │ │ │ │ ├── AccountController.cs │ │ │ │ ├── DictController.cs │ │ │ │ ├── DictDataController.cs │ │ │ │ ├── MenuController.cs │ │ │ │ ├── NoticeController.cs │ │ │ │ ├── OrganizationController.cs │ │ │ │ ├── RoleController.cs │ │ │ │ ├── SysConfigController.cs │ │ │ │ └── UserController.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── Grpc │ │ │ │ ├── AdminGrpcServer.cs │ │ │ │ └── AuthGrpcServer.cs │ │ │ ├── MiddlewareRegistrar.cs │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ ├── appsettings.Development.json │ │ │ ├── appsettings.Production.json │ │ │ ├── appsettings.Staging.json │ │ │ ├── appsettings.Test.json │ │ │ └── appsettings.json │ │ ├── Admin.Application.Contracts │ │ │ ├── Adnc.Demo.Admin.Application.Contracts.csproj │ │ │ ├── Dtos │ │ │ │ ├── Dict │ │ │ │ │ ├── DictCreationDto.cs │ │ │ │ │ ├── DictDto.cs │ │ │ │ │ ├── DictOptionDto.cs │ │ │ │ │ ├── DictSearchPagedDto.cs │ │ │ │ │ ├── DictUpdationDto.cs │ │ │ │ │ └── DtoValidators │ │ │ │ │ │ ├── DictCreationDtoValidator.cs │ │ │ │ │ │ └── DictUpdationDtoValidator.cs │ │ │ │ ├── Menu │ │ │ │ │ ├── DtoValidators │ │ │ │ │ │ ├── MenuCreationDtoValidator.cs │ │ │ │ │ │ └── MenuUpdationDtoValidator.cs │ │ │ │ │ ├── MenuCreationDto.cs │ │ │ │ │ ├── MenuDto.cs │ │ │ │ │ ├── MenuTreeDto.cs │ │ │ │ │ ├── MenuTypeEnum.cs │ │ │ │ │ ├── MenuUpdationDto.cs │ │ │ │ │ └── RouterTreeDto.cs │ │ │ │ ├── Notice │ │ │ │ │ ├── NoticeDto.cs │ │ │ │ │ └── NoticeSearchPagedDto.cs │ │ │ │ ├── Organization │ │ │ │ │ ├── DtoValidators │ │ │ │ │ │ ├── OrganizationCreationDtoValidator.cs │ │ │ │ │ │ └── OrganizationUpdationDtoValidator.cs │ │ │ │ │ ├── OrganizationCreationDto.cs │ │ │ │ │ ├── OrganizationDto.cs │ │ │ │ │ ├── OrganizationTreeDto.cs │ │ │ │ │ └── OrganizationUpdationDto.cs │ │ │ │ ├── Role │ │ │ │ │ ├── DtoValidators │ │ │ │ │ │ ├── RoleCreationDtoValidator.cs │ │ │ │ │ │ ├── RoleSetPermissonsDtoValidator.cs │ │ │ │ │ │ └── RoleUpdationDtoValidator.cs │ │ │ │ │ ├── RoleCreationDto.cs │ │ │ │ │ ├── RoleDto.cs │ │ │ │ │ ├── RoleMenuCodeDto.cs │ │ │ │ │ ├── RoleMenuRelationDto.cs │ │ │ │ │ ├── RoleSetPermissonsDto.cs │ │ │ │ │ └── RoleUpdationDto.cs │ │ │ │ ├── SysConfig │ │ │ │ │ ├── DtoValidators │ │ │ │ │ │ ├── SysConfigCreationDtoValidator.cs │ │ │ │ │ │ └── SysConfigUpdationDtoValidator.cs │ │ │ │ │ ├── SysConfigCreationDto.cs │ │ │ │ │ ├── SysConfigDto.cs │ │ │ │ │ ├── SysConfigSimpleDto.cs │ │ │ │ │ └── SysConfigUpdationDto.cs │ │ │ │ └── User │ │ │ │ │ ├── DtoValidators │ │ │ │ │ ├── UserChangeProfileDtoValidator.cs │ │ │ │ │ ├── UserChangePwdDtoValidator.cs │ │ │ │ │ ├── UserCreationAndUpdationDtoValidator.cs │ │ │ │ │ ├── UserCreationDtoValidator.cs │ │ │ │ │ ├── UserLoginDtoValidator.cs │ │ │ │ │ └── UserUpdationDtoValidator.cs │ │ │ │ │ ├── UserCreationAndUpdationDto.cs │ │ │ │ │ ├── UserCreationDto.cs │ │ │ │ │ ├── UserDto.cs │ │ │ │ │ ├── UserInfoDto.cs │ │ │ │ │ ├── UserLoginDto.cs │ │ │ │ │ ├── UserProfileDto.cs │ │ │ │ │ ├── UserRefreshTokenDto.cs │ │ │ │ │ ├── UserSearchPagedDto.cs │ │ │ │ │ ├── UserTokenInfoDto.cs │ │ │ │ │ ├── UserUpdationDto.cs │ │ │ │ │ └── UserValidatedInfoDto.cs │ │ │ ├── GlobalUsings.cs │ │ │ └── Services │ │ │ │ ├── IDictDataService.cs │ │ │ │ ├── IDictService.cs │ │ │ │ ├── IMenuService.cs │ │ │ │ ├── IOrganizationService.cs │ │ │ │ ├── IRoleService.cs │ │ │ │ ├── ISysConfigService.cs │ │ │ │ └── IUserService.cs │ │ ├── Admin.Application │ │ │ ├── Adnc.Demo.Admin.Application.csproj │ │ │ ├── Cache │ │ │ │ ├── AccountBloomFilter.cs │ │ │ │ ├── CacheKeyBloomFilter.cs │ │ │ │ └── CacheService.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MapperProfile.cs │ │ │ └── Services │ │ │ │ ├── DictDataService.cs │ │ │ │ ├── DictService.cs │ │ │ │ ├── MenuService.cs │ │ │ │ ├── OrganizationService.cs │ │ │ │ ├── RoleService.cs │ │ │ │ ├── SysConfigService.cs │ │ │ │ └── UserService.cs │ │ └── Admin.Repository │ │ │ ├── Adnc.Demo.Admin.Repository.csproj │ │ │ ├── Entities │ │ │ ├── Config │ │ │ │ ├── DictConfig.cs │ │ │ │ ├── MenuConfig.cs │ │ │ │ ├── OrganizationConfig.cs │ │ │ │ ├── RoleConfig.cs │ │ │ │ ├── RoleMenuRelationConfig.cs │ │ │ │ ├── RoleUserRelationConfig.cs │ │ │ │ ├── SysConfigConfig.cs │ │ │ │ └── UserConfig.cs │ │ │ ├── Dict.cs │ │ │ ├── Menu.cs │ │ │ ├── Organization.cs │ │ │ ├── Role.cs │ │ │ ├── RoleMenuRelation.cs │ │ │ ├── RoleUserRelation.cs │ │ │ ├── SysConfig.cs │ │ │ └── User.cs │ │ │ ├── EntityInfo.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MenuRepositoryExtension.cs │ │ │ └── Migrations │ │ │ ├── 20250311045441_Init20250311.Designer.cs │ │ │ ├── 20250311045441_Init20250311.cs │ │ │ ├── 20250312052404_Update-2025031201.Designer.cs │ │ │ ├── 20250312052404_Update-2025031201.cs │ │ │ ├── 20250312122420_Update-2025031202.Designer.cs │ │ │ ├── 20250312122420_Update-2025031202.cs │ │ │ ├── 20250312140312_Update-2025031203.Designer.cs │ │ │ ├── 20250312140312_Update-2025031203.cs │ │ │ ├── 20250313164005_Update2025031401.Designer.cs │ │ │ ├── 20250313164005_Update2025031401.cs │ │ │ ├── 20250316133304_Update2025031601.Designer.cs │ │ │ ├── 20250316133304_Update2025031601.cs │ │ │ ├── 20250317153239_Update2025031702.Designer.cs │ │ │ ├── 20250317153239_Update2025031702.cs │ │ │ ├── 20250323101948_Update25032301.Designer.cs │ │ │ ├── 20250323101948_Update25032301.cs │ │ │ └── MySqlDbContextModelSnapshot.cs │ ├── Adnc.Demo.sln │ ├── Cust │ │ └── Cust.Api │ │ │ ├── Adnc.Demo.Cust.Api.csproj │ │ │ ├── Application │ │ │ ├── Dtos │ │ │ │ ├── CustomerCreationDto.cs │ │ │ │ ├── CustomerDto.cs │ │ │ │ ├── CustomerRechargeDto.cs │ │ │ │ ├── DtoValidators │ │ │ │ │ ├── CustomerCreationDtoValidator.cs │ │ │ │ │ └── CustomerRechargeDtoValidator.cs │ │ │ │ └── TransactionLogDto.cs │ │ │ ├── Services │ │ │ │ ├── ICustomerService.cs │ │ │ │ └── Implements │ │ │ │ │ └── CustomerService.cs │ │ │ └── Subscribers │ │ │ │ └── CapEventSubscriber.cs │ │ │ ├── Controllers │ │ │ ├── CustomerController.cs │ │ │ ├── GrpcClientDemoController.cs │ │ │ └── RestClientDemoController.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MapperProfile.cs │ │ │ ├── MiddlewareRegistrar.cs │ │ │ ├── Migrations │ │ │ ├── 20250317152707_Init20250317.Designer.cs │ │ │ ├── 20250317152707_Init20250317.cs │ │ │ ├── 20250323102232_Update25032301.Designer.cs │ │ │ ├── 20250323102232_Update25032301.cs │ │ │ └── MySqlDbContextModelSnapshot.cs │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ └── launchSettings.json │ │ │ ├── Repository │ │ │ ├── Entities │ │ │ │ ├── Config │ │ │ │ │ ├── CustomerConfig.cs │ │ │ │ │ ├── FinanceConfig.cs │ │ │ │ │ └── TransactionLogConfig.cs │ │ │ │ ├── Customer.cs │ │ │ │ ├── EntityInfo.cs │ │ │ │ ├── Finance.cs │ │ │ │ └── TransactionLog.cs │ │ │ └── RepositoryExtension.cs │ │ │ ├── appsettings.Development.json │ │ │ ├── appsettings.Production.json │ │ │ ├── appsettings.Staging.json │ │ │ ├── appsettings.Test.json │ │ │ └── appsettings.json │ ├── Directory.Build.props │ ├── Maint │ │ ├── Maint.Api │ │ │ ├── Adnc.Demo.Maint.Api.csproj │ │ │ ├── Controllers │ │ │ │ ├── LoginLogController.cs │ │ │ │ └── OperationLogController.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MiddlewareRegistrar.cs │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ ├── appsettings.Development.json │ │ │ ├── appsettings.Production.json │ │ │ ├── appsettings.Staging.json │ │ │ ├── appsettings.Test.json │ │ │ └── appsettings.json │ │ ├── Maint.Application │ │ │ ├── Adnc.Demo.Maint.Application.csproj │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── Dtos │ │ │ │ ├── LoginLogDto.cs │ │ │ │ ├── NlogLogDto.cs │ │ │ │ └── OperationLogDto.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MapperProfile.cs │ │ │ ├── Services │ │ │ │ ├── ILogService.cs │ │ │ │ └── Implements │ │ │ │ │ └── LogService.cs │ │ │ └── Subscribers │ │ │ │ ├── LoginLogMqConsumer.cs │ │ │ │ └── OpsLogMqConsumer.cs │ │ └── Maint.Repository │ │ │ ├── Adnc.Demo.Maint.Repository.csproj │ │ │ ├── GlobalUsings.cs │ │ │ └── RepositoryExtension.cs │ ├── Ord │ │ ├── Ord.Api │ │ │ ├── Adnc.Demo.Ord.Api.csproj │ │ │ ├── Controllers │ │ │ │ └── OrderController.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MiddlewareRegistrar.cs │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ ├── appsettings.Development.json │ │ │ ├── appsettings.Production.json │ │ │ ├── appsettings.Staging.json │ │ │ ├── appsettings.Test.json │ │ │ └── appsettings.json │ │ ├── Ord.Application │ │ │ ├── Adnc.Demo.Ord.Application.csproj │ │ │ ├── Cache │ │ │ │ └── CacheService.cs │ │ │ ├── DependencyRegistrar.cs │ │ │ ├── Dtos │ │ │ │ ├── OrderCreationDto.cs │ │ │ │ ├── OrderDto.cs │ │ │ │ ├── OrderMarkCreatedStatusDto.cs │ │ │ │ ├── OrderReceiverDto.cs │ │ │ │ ├── OrderSearchDto.cs │ │ │ │ └── OrderUpdationDto.cs │ │ │ ├── GlobalUsings.cs │ │ │ ├── MapperProfile.cs │ │ │ ├── Services │ │ │ │ ├── IOrderService.cs │ │ │ │ └── Implements │ │ │ │ │ └── OrderService.cs │ │ │ └── Subscribers │ │ │ │ └── CapEventSubscriber.cs │ │ ├── Ord.Domain │ │ │ ├── Adnc.Demo.Ord.Domain.csproj │ │ │ ├── Aggregates │ │ │ │ └── OrderAggregate │ │ │ │ │ ├── Order.cs │ │ │ │ │ ├── OrderItem.cs │ │ │ │ │ ├── OrderItemProduct.cs │ │ │ │ │ ├── OrderReceiver.cs │ │ │ │ │ ├── OrderStatus.cs │ │ │ │ │ └── OrderStatusCodes.cs │ │ │ ├── EntityConfig │ │ │ │ ├── EntityInfo.cs │ │ │ │ ├── OrderConfig.cs │ │ │ │ └── OrderItemConfig.cs │ │ │ ├── GlobalUsings.cs │ │ │ └── Services │ │ │ │ └── OrderManager.cs │ │ └── Ord.Migrations │ │ │ ├── Adnc.Demo.Ord.Migrations.csproj │ │ │ └── Migrations │ │ │ └── MySqlDbContextModelSnapshot.cs │ ├── Shared │ │ ├── Const │ │ │ ├── Adnc.Demo.Const.csproj │ │ │ ├── Caching │ │ │ │ ├── CachingConsts.Admin.cs │ │ │ │ ├── CachingConsts.Cust.cs │ │ │ │ └── CachingConsts.Maint.cs │ │ │ ├── Entity │ │ │ │ ├── EntityConsts.Admin.cs │ │ │ │ ├── EntityConsts.Cust.cs │ │ │ │ ├── EntityConsts.Maint.cs │ │ │ │ ├── EntityConsts.Ord.cs │ │ │ │ └── EntityConsts.Whse.cs │ │ │ ├── Mq │ │ │ │ ├── MqConsts.Exchanges.cs │ │ │ │ └── MqConsts.RoutingKeys.cs │ │ │ ├── Permission │ │ │ │ ├── Permissions.Admin.cs │ │ │ │ ├── Permissions.Cust.cs │ │ │ │ └── Permissions.Maint.cs │ │ │ ├── RouteConsts.cs │ │ │ └── ServiceAddressConsts.cs │ │ ├── Remote.Event │ │ │ ├── Adnc.Demo.Remote.Event.csproj │ │ │ ├── CustomerRechargedEvent.cs │ │ │ ├── OrderCanceledEvent.cs │ │ │ ├── OrderCreatedEvent.cs │ │ │ ├── OrderPaidEvent.cs │ │ │ └── WarehouseQtyBlockedEvent.cs │ │ ├── Remote.Grpc │ │ │ ├── Adnc.Demo.Remote.Grpc.csproj │ │ │ ├── CustomTypes.cs │ │ │ ├── GlobalUsings.cs │ │ │ └── GrpcClientConsts.cs │ │ ├── Remote.Http │ │ │ ├── Adnc.Demo.Remote.Http.csproj │ │ │ ├── GlobalUsings.cs │ │ │ ├── Messages │ │ │ │ ├── DictOptionResponse.cs │ │ │ │ ├── ProductResponse.cs │ │ │ │ ├── ProductSearchRequest.cs │ │ │ │ └── SysConfigSimpleResponse.cs │ │ │ └── Services │ │ │ │ ├── IAdminRestClient.cs │ │ │ │ ├── IOrderRestClient.cs │ │ │ │ └── IWhseRestClient.cs │ │ ├── protos │ │ │ ├── messages │ │ │ │ ├── common.proto │ │ │ │ ├── sys_config.proto │ │ │ │ └── sys_dictoption.proto │ │ │ └── services │ │ │ │ └── admingrpc.proto │ │ └── resources │ │ │ ├── NLog │ │ │ ├── nlog-all.config │ │ │ ├── nlog-console.config │ │ │ ├── nlog-file.config │ │ │ └── nlog-loki.config │ │ │ ├── appsettings.shared.Development.json │ │ │ ├── swagger_miniprofiler.html │ │ │ └── wwwroot │ │ │ └── favicon.ico │ └── Whse │ │ ├── Whse.Api │ │ ├── Adnc.Demo.Whse.Api.csproj │ │ ├── Controllers │ │ │ ├── ProductController.cs │ │ │ └── WarehouseController.cs │ │ ├── DependencyRegistrar.cs │ │ ├── GlobalUsings.cs │ │ ├── MiddlewareRegistrar.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── appsettings.Development.json │ │ ├── appsettings.Production.json │ │ ├── appsettings.Staging.json │ │ ├── appsettings.Test.json │ │ └── appsettings.json │ │ ├── Whse.Application │ │ ├── Adnc.Demo.Whse.Application.csproj │ │ ├── Cache │ │ │ └── CacheService.cs │ │ ├── DependencyRegistrar.cs │ │ ├── Dtos │ │ │ ├── ProducChangePriceDto.cs │ │ │ ├── ProductCreationDto.cs │ │ │ ├── ProductDto.cs │ │ │ ├── ProductPutOffSaleDto.cs │ │ │ ├── ProductPutOnSaleDto.cs │ │ │ ├── ProductSearchListDto.cs │ │ │ ├── ProductSearchPagedDto.cs │ │ │ ├── ProductUpdationDto.cs │ │ │ ├── WarehouseAllocateToProductDto.cs │ │ │ ├── WarehouseBlockQtyDto.cs │ │ │ ├── WarehouseCreationDto.cs │ │ │ ├── WarehouseDto.cs │ │ │ └── WarehouseSearchDto.cs │ │ ├── GlobalUsings.cs │ │ ├── MapperProfile.cs │ │ ├── Services │ │ │ ├── IProductService.cs │ │ │ ├── IWarehouseService.cs │ │ │ └── Implements │ │ │ │ ├── ProductService.cs │ │ │ │ └── WarehouseService.cs │ │ └── Subscribers │ │ │ └── CapEventSubscriber.cs │ │ ├── Whse.Domain │ │ ├── Adnc.Demo.Whse.Domain.csproj │ │ ├── Aggregates │ │ │ ├── ProductAggregate │ │ │ │ ├── Product.cs │ │ │ │ └── ProductStatus.cs │ │ │ ├── ProductStatusCodes.cs │ │ │ └── WarehouseAggregate │ │ │ │ ├── InventoryChangeLogs.cs │ │ │ │ ├── Warehouse.cs │ │ │ │ └── WarehousePosition.cs │ │ ├── EntityConfig │ │ │ ├── EntityInfo.cs │ │ │ ├── ProductConfig.cs │ │ │ └── WarehouseConfig.cs │ │ ├── GlobalUsings.cs │ │ └── Services │ │ │ ├── ProductManager.cs │ │ │ └── WarehouseManager.cs │ │ └── Whse.Migrations │ │ ├── Adnc.Demo.Whse.Migrations.csproj │ │ └── Migrations │ │ ├── 20230405141845_Init.Designer.cs │ │ ├── 20230405141845_Init.cs │ │ └── SqlServerDbContextModelSnapshot.cs ├── Directory.Build.props ├── Gateways │ └── Ocelot │ │ ├── Adnc.Gateway.Ocelot.csproj │ │ ├── Adnc.Ocelot.sln │ │ ├── ApplicationBuilderExtension.cs │ │ ├── Config │ │ ├── ocelot.consul.json │ │ ├── ocelot.direct.json │ │ ├── ocelot.directjwt.json │ │ └── ocelot.fabio.json │ │ ├── Identity │ │ └── JwtSecurityTokenHandlerExtension.cs │ │ ├── IpAddressConsulServiceBuilder.cs │ │ ├── JWTOptions.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── ServiceRouter.cs │ │ ├── Startup.cs │ │ ├── ThreadPoolSettings.cs │ │ ├── appsettings.Development.json │ │ ├── appsettings.Production.json │ │ ├── appsettings.Staging.json │ │ ├── appsettings.Test.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── adnc-topics.png │ │ └── favicon.ico ├── Infrastructures │ ├── Adnc.Infra.sln │ ├── Consul │ │ ├── Adnc.Infra.Consul.csproj │ │ ├── Configuration │ │ │ ├── ConsulOptions.cs │ │ │ ├── DefaultConsulConfigurationProvider.cs │ │ │ ├── DefaultConsulConfigurationSource.cs │ │ │ └── JsonConfigurationFileParser.cs │ │ ├── Discover │ │ │ ├── Balancers │ │ │ │ ├── ILoadBalancer.cs │ │ │ │ ├── RandomLoadBalancer.cs │ │ │ │ ├── RoundRobinLoadBalancer.cs │ │ │ │ └── TypeLoadBalancer.cs │ │ │ ├── DiscoverProvider.cs │ │ │ ├── DiscoverProviderBuilder.cs │ │ │ ├── GrpcResolver │ │ │ │ └── ConsulGrpcResolver.cs │ │ │ ├── Handler │ │ │ │ └── ConsulDiscoverDelegatingHandler.cs │ │ │ └── IDiscoverProvider.cs │ │ ├── Extensions │ │ │ ├── ConfigurationBuilderExtension.cs │ │ │ ├── HostExtension.cs │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ └── Registrar │ │ │ ├── KestrelOptions.cs │ │ │ └── RegistrationProvider.cs │ ├── Core │ │ ├── Adnc.Infra.Core.csproj │ │ ├── DependencyInjection │ │ │ └── ServiceLocator.cs │ │ ├── Exceptions │ │ │ ├── BusinessException.cs │ │ │ ├── IAdncException.cs │ │ │ └── InvalidVariableException.cs │ │ ├── Extensions │ │ │ ├── Byte │ │ │ │ └── ByteArrayExtension.cs │ │ │ ├── Collection │ │ │ │ ├── ArrayExtension.cs │ │ │ │ ├── CollectionExtension.cs │ │ │ │ ├── IEnumerableExtensions.cs │ │ │ │ └── NameValueCollectionExtension.cs │ │ │ ├── DateTime │ │ │ │ └── DataTimeExtension.cs │ │ │ ├── Enum │ │ │ │ └── EnumExtension.cs │ │ │ ├── Exception │ │ │ │ └── ExceptionExtension.cs │ │ │ ├── Expression │ │ │ │ ├── ExpressionCreator.cs │ │ │ │ ├── ExpressionLogicalOperatorsExtension .cs │ │ │ │ └── ExpressionMethodsExtension.cs │ │ │ ├── HttpStatusCode │ │ │ │ └── HttpStatusCodeExtensions.cs │ │ │ ├── Int │ │ │ │ └── IntExtension.cs │ │ │ ├── Object │ │ │ │ └── ObjectExtension.cs │ │ │ ├── Random │ │ │ │ └── RandomExtension.cs │ │ │ ├── ServiceCollection │ │ │ │ └── ServiceCollectionExtensions.cs │ │ │ ├── Stream │ │ │ │ └── StreamExtensions.cs │ │ │ ├── String │ │ │ │ └── StringExtension.cs │ │ │ ├── StringBuilder │ │ │ │ └── StringBuilderExtension.cs │ │ │ └── Type │ │ │ │ ├── AssemblyExtension.cs │ │ │ │ ├── DocumenationExtension.cs │ │ │ │ ├── MethodInfoExtension.cs │ │ │ │ ├── ReflectionExtension.cs │ │ │ │ └── TypeExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── Guard │ │ │ ├── ArgumentChecker.cs │ │ │ ├── Checker.cs │ │ │ └── VariableChecker.cs │ │ ├── Internal │ │ │ └── ReflectionDictionary.cs │ │ └── Json │ │ │ ├── BoolConverter.cs │ │ │ ├── DateTimeConverter.cs │ │ │ ├── DateTimeNullableConverter.cs │ │ │ └── SystemTextJson.cs │ ├── Directory.Build.props │ ├── EventBus │ │ ├── Adnc.Infra.EventBus.csproj │ │ ├── Cap │ │ │ ├── CapPublisher.cs │ │ │ ├── Filters │ │ │ │ └── DefaultCapFilter.cs │ │ │ └── NullCapPublisher.cs │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── IEventPublisher.cs │ │ └── RabbitMq │ │ │ ├── BaseRabbitMqConsumer.cs │ │ │ ├── ConnectionManager.cs │ │ │ ├── ExchageConfig.cs │ │ │ ├── ExchangeType.cs │ │ │ ├── QueueConfig.cs │ │ │ └── RabbitMqProducer.cs │ ├── Helper │ │ ├── Adnc.Infra.Helper.csproj │ │ ├── GlobalUsings.cs │ │ ├── InfraHelper.cs │ │ └── Internal │ │ │ ├── Encrypt │ │ │ ├── EncryptProivder.Aes.cs │ │ │ ├── EncryptProivder.cs │ │ │ ├── EncryptProvider.Base64.cs │ │ │ ├── EncryptProvider.Des.cs │ │ │ ├── EncryptProvider.MachineKey.cs │ │ │ ├── EncryptProvider.Md5.cs │ │ │ ├── EncryptProvider.Rsa.cs │ │ │ ├── EncryptProvider.Sha.cs │ │ │ ├── Exception │ │ │ │ └── OutofMaxlengthException.cs │ │ │ ├── Extensions │ │ │ │ ├── EncryptExtensions.cs │ │ │ │ └── RsaKeyExtensions.cs │ │ │ └── Shared │ │ │ │ ├── AESKey.cs │ │ │ │ ├── MD5Length.cs │ │ │ │ ├── RSAKey.cs │ │ │ │ ├── RSAParametersJson.cs │ │ │ │ ├── RsaKeyType.cs │ │ │ │ ├── RsaProvider.cs │ │ │ │ └── RsaSize.cs │ │ │ ├── HashConsistentGenerater.cs │ │ │ ├── HttpContextAccessor.cs │ │ │ └── IdGenerater │ │ │ └── Snowflake.cs │ ├── IdGenerater │ │ ├── Adnc.Infra.IdGenerater.csproj │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ └── Yitter │ │ │ ├── IdGenerater.cs │ │ │ ├── WorkerNode.cs │ │ │ └── WorkerNodeHostedService.cs │ ├── Redis.Caching │ │ ├── Adnc.Infra.Redis.Caching.csproj │ │ ├── Configurations │ │ │ └── CacheOptions.cs │ │ ├── Core │ │ │ ├── BloomFilter │ │ │ │ ├── AbstractBloomFilter.cs │ │ │ │ ├── BloomFilterFactory.cs │ │ │ │ ├── BloomFilterHostedService.cs │ │ │ │ └── NullBloomFilter.cs │ │ │ ├── Diagnostics │ │ │ │ ├── BeforeExistsRequestEventData.cs │ │ │ │ ├── BeforeGetRequestEventData.cs │ │ │ │ ├── BeforePublishMessageRequestEventData.cs │ │ │ │ ├── BeforeRemoveRequestEventData.cs │ │ │ │ ├── BeforeSetRequestEventData.cs │ │ │ │ ├── BeforeSubscribeMessageRequestEventData.cs │ │ │ │ ├── CachingDiagnosticListenerExtensions.cs │ │ │ │ ├── DiagnosticDataWrapper.cs │ │ │ │ ├── EventData.cs │ │ │ │ └── SkyApm │ │ │ │ │ └── CacheTracingDiagnosticProcessor.cs │ │ │ ├── Interceptor │ │ │ │ ├── CachingAbleAttribute.cs │ │ │ │ ├── CachingEvictAttribute.cs │ │ │ │ ├── CachingInterceptorAttribute.cs │ │ │ │ ├── CachingParamAttribute.cs │ │ │ │ ├── CachingPutAttribute.cs │ │ │ │ ├── Castle │ │ │ │ │ ├── CachingAsyncInterceptor.cs │ │ │ │ │ ├── CachingInterceptor.cs │ │ │ │ │ └── TypeExtensions.cs │ │ │ │ ├── DefaultCachingKeyGenerator.cs │ │ │ │ ├── ICachable.cs │ │ │ │ ├── ICachingKeyGenerator.cs │ │ │ │ └── ParameterCacheKeys.cs │ │ │ ├── Internal │ │ │ │ ├── CacheValue.cs │ │ │ │ └── CachingConstValue.cs │ │ │ ├── Preheater │ │ │ │ ├── AbstractCacheService.cs │ │ │ │ ├── CachingHostedService.cs │ │ │ │ └── ICachePreheatable.cs │ │ │ └── Stats │ │ │ │ ├── CacheStats.cs │ │ │ │ ├── CacheStatsCounter.cs │ │ │ │ ├── LocalVariables.cs │ │ │ │ └── StatsType.cs │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── ICacheProvider.cs │ │ └── Provider │ │ │ ├── AbstracCacheProvider.cs │ │ │ ├── DefaultCachingProvider.Async.cs │ │ │ └── DefaultCachingProvider.cs │ ├── Redis │ │ ├── Adnc.Infra.Redis.csproj │ │ ├── Configurations │ │ │ ├── DBOptions.cs │ │ │ ├── RedisOptions.cs │ │ │ └── ServerEndPoint.cs │ │ ├── Core │ │ │ ├── Internal │ │ │ │ ├── AutoDelayTimers.cs │ │ │ │ ├── ConstValue.cs │ │ │ │ └── TypeHelper.cs │ │ │ └── Serialization │ │ │ │ ├── DefaultBinarySerializer.cs │ │ │ │ ├── DefaultJsonSerializer.cs │ │ │ │ ├── DefaultProtobufSerializer.cs │ │ │ │ └── ISerializer.cs │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── IDistributedLocker.cs │ │ ├── IRedisProvider.cs │ │ └── Providers │ │ │ └── StackExchange │ │ │ ├── DefaultDatabaseProvider.cs │ │ │ ├── DefaultRedisProvider.Bitmap.cs │ │ │ ├── DefaultRedisProvider.BloomFilter.cs │ │ │ ├── DefaultRedisProvider.Geo.cs │ │ │ ├── DefaultRedisProvider.Hash.cs │ │ │ ├── DefaultRedisProvider.Hyperloglog.cs │ │ │ ├── DefaultRedisProvider.Keys.cs │ │ │ ├── DefaultRedisProvider.List.cs │ │ │ ├── DefaultRedisProvider.Locker.cs │ │ │ ├── DefaultRedisProvider.ScriptEvaluate.cs │ │ │ ├── DefaultRedisProvider.Set.cs │ │ │ ├── DefaultRedisProvider.SortedSet.cs │ │ │ ├── DefaultRedisProvider.Stream.cs │ │ │ ├── DefaultRedisProvider.String.cs │ │ │ ├── DefaultRedisProvider.cs │ │ │ ├── EasyCaching.Redis.csproj │ │ │ └── IDatabaseExtension.cs │ ├── Repository.Dapper │ │ ├── Adnc.Infra.Repository.Dapper.csproj │ │ ├── DapperRepository.cs │ │ ├── Extensions │ │ │ ├── ConfigurationExtension.cs │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ └── Internal │ │ │ └── TimeStampeHandler .cs │ ├── Repository.EfCore.MongoDB │ │ ├── AbstractMongoDbEntityInfo.cs │ │ ├── Adnc.Infra.Repository.EfCore.MongoDB.csproj │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── MongoDbContext.cs │ │ ├── MongoEntity.cs │ │ ├── Repositories │ │ │ └── MongoDbRepository.cs │ │ └── Transaction │ │ │ └── MongoDbUnitOfWork.cs │ ├── Repository.EfCore.Mysql │ │ ├── Adnc.Infra.Repository.EfCore.MySql.csproj │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── MySQLDbContext.cs │ │ ├── SqlGenerator │ │ │ └── MySql │ │ │ │ ├── AdncMySqlQuerySqlGeneratorFactory.cs │ │ │ │ └── AdncQuerySqlGenerator.cs │ │ └── Transaction │ │ │ └── MySQLUnitOfWork.cs │ ├── Repository.EfCore.SqlServer │ │ ├── Adnc.Infra.Repository.EfCore.SqlServer.csproj │ │ ├── Extensions │ │ │ └── ServiceCollectionExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── SqlServerDbContext.cs │ │ └── Transaction │ │ │ └── SqlServerUnitOfWork.cs │ ├── Repository.EfCore │ │ ├── AbstractEntityInfo.cs │ │ ├── AbstractEntityTypeConfiguration.cs │ │ ├── Adnc.Infra.Repository.EfCore.csproj │ │ ├── AdncDbContext.cs │ │ ├── Extensions │ │ │ ├── EntityEntryExtension.cs │ │ │ ├── PocoLoadingExtension.cs │ │ │ ├── ServiceCollectionExtension.cs │ │ │ └── SetPropertyCallsExtensions.cs │ │ ├── GlobalUsings.cs │ │ ├── Internal │ │ │ ├── ExpressionHelper.cs │ │ │ └── KeyEntryModel.cs │ │ ├── NullEntityInfo.cs │ │ ├── Repositories │ │ │ ├── AbstractEfBaseRepository.cs │ │ │ ├── EfBasicRepository.cs │ │ │ └── EfRepository.cs │ │ └── Transaction │ │ │ └── UnitOfWork.cs │ ├── Repository │ │ ├── Adnc.Infra.Repository.csproj │ │ ├── Entities │ │ │ ├── EfEnities │ │ │ │ ├── EfBasicAuditEntity.cs │ │ │ │ ├── EfEntity.cs │ │ │ │ ├── EfFullAuditEntity.cs │ │ │ │ └── IEfEntity.cs │ │ │ ├── Entity.cs │ │ │ ├── IBasicAuditInfo.cs │ │ │ ├── IConcurrency.cs │ │ │ ├── IEntity.cs │ │ │ ├── IEntityInfo.cs │ │ │ ├── IFullAuditInfo.cs │ │ │ └── ISoftDelete.cs │ │ ├── GlobalUsings.cs │ │ ├── Interceptor │ │ │ ├── Castle │ │ │ │ ├── UowAsyncInterceptor.cs │ │ │ │ └── UowInterceptor.cs │ │ │ └── UnitOfWorkAttribute.cs │ │ └── Interface │ │ │ ├── DbTypes.cs │ │ │ ├── IAdoExecuterRepository.cs │ │ │ ├── IAdoExecuterWithQuerierRepository.cs │ │ │ ├── IAdoQuerierRepository.cs │ │ │ ├── IAdoRepository.cs │ │ │ ├── IEfBaseRepository.cs │ │ │ ├── IEfBasicRepository.cs │ │ │ ├── IEfRepository.cs │ │ │ ├── IMongoDbRepository.cs │ │ │ ├── IRepository.cs │ │ │ ├── IUnitOfWork.cs │ │ │ ├── Models │ │ │ ├── Operater.cs │ │ │ ├── PagedModel.cs │ │ │ └── RawSqlQueryModel.cs │ │ │ └── RepositoryConsts.cs │ └── logo.png ├── ServiceShared │ ├── Adnc.Shared.sln │ ├── Application.Contracts │ │ ├── Adnc.Shared.Application.Contracts.csproj │ │ ├── Attributes │ │ │ └── OperateLogAttribute.cs │ │ ├── Dtos │ │ │ ├── IDto.cs │ │ │ ├── IdDto.cs │ │ │ ├── InputDto.cs │ │ │ ├── InputSimpleDto.cs │ │ │ ├── MongoDto.cs │ │ │ ├── OptionDto.cs │ │ │ ├── OutputBaseAuditDto.cs │ │ │ ├── OutputDto.cs │ │ │ ├── OutputFullAuditInfoDto.cs │ │ │ ├── PageModelDto.cs │ │ │ ├── SearchDto.cs │ │ │ ├── SearchPagedDto.cs │ │ │ └── SimpleDto.cs │ │ ├── Enums │ │ │ └── TrackerKind.cs │ │ ├── GlobalUsings.cs │ │ ├── Interfaces │ │ │ ├── IAppService.cs │ │ │ └── IMessageTracker.cs │ │ ├── ResultModels │ │ │ ├── AppServiceResult.cs │ │ │ ├── ProblemDetails.cs │ │ │ └── ServiceResult.cs │ │ └── Validators │ │ │ ├── FluentValidationExtensions.cs │ │ │ └── Regulars.cs │ ├── Application │ │ ├── Adnc.Shared.Application.csproj │ │ ├── Channels │ │ │ ├── ChannelAccessor.cs │ │ │ └── LogConsumersHostedService.cs │ │ ├── Extensions │ │ │ ├── DependencyRegistrarExtension.cs │ │ │ ├── HttpClientBuilderExtension.cs │ │ │ ├── MessageTrackerExtension.cs │ │ │ └── SearchPagedDtoExtension.cs │ │ ├── GlobalUsings.cs │ │ ├── Interceptors │ │ │ └── OperateLog │ │ │ │ ├── OperateLogAsyncInterceptor.cs │ │ │ │ └── OperateLogInterceptor.cs │ │ ├── Mapper │ │ │ ├── AutoMapper │ │ │ │ └── AutoMapperObject.cs │ │ │ └── IObjectMapper.cs │ │ ├── Registrar │ │ │ ├── AbstractApplicationDependencyRegistrar.DomainSerivces.cs │ │ │ ├── AbstractApplicationDependencyRegistrar.EventBus.cs │ │ │ ├── AbstractApplicationDependencyRegistrar.Repositories.cs │ │ │ ├── AbstractApplicationDependencyRegistrar.RpcClient.cs │ │ │ └── AbstractApplicationDependencyRegistrar.cs │ │ └── Services │ │ │ ├── AbstractAppService.cs │ │ │ └── Trackers │ │ │ ├── DbMessageTrackerService.cs │ │ │ ├── MessageTrackerFactory.cs │ │ │ ├── NullMessageTrackerService.cs │ │ │ └── RedisMessageTrackerService.cs │ ├── Directory.Build.props │ ├── Domain │ │ ├── Adnc.Shared.Domain.csproj │ │ ├── Entities │ │ │ ├── AbstractDomainEntityInfo.cs │ │ │ ├── AggregateRoot.cs │ │ │ ├── AggregateRootWithBasicAuditInfo.cs │ │ │ ├── DomainEntity.cs │ │ │ └── ValueObject.cs │ │ ├── GlobalUsings.cs │ │ └── IDomainService.cs │ ├── Remote │ │ ├── Adnc.Shared.Remote.csproj │ │ ├── Event │ │ │ ├── CustomCapFilter.cs │ │ │ └── EventEntity.cs │ │ ├── GlobalUsings.cs │ │ ├── Handlers │ │ │ ├── CacheDelegatingHandler.cs │ │ │ ├── Token │ │ │ │ ├── BasicOptions.cs │ │ │ │ ├── BasicTokenGenerator.cs │ │ │ │ ├── BasicTokenValidator.cs │ │ │ │ ├── BearerTokenGenerator.cs │ │ │ │ ├── ITokenGenerator.cs │ │ │ │ ├── TokenFactory.cs │ │ │ │ └── UnPackedResult.cs │ │ │ └── TokenDelegatingHandler.cs │ │ ├── Http │ │ │ ├── IRestClient.cs │ │ │ ├── Messages │ │ │ │ ├── LoginResponse.cs │ │ │ │ └── UserValidatedInfoResponse.cs │ │ │ └── Services │ │ │ │ └── IAuthRestClient.cs │ │ └── RpcInfo.cs │ ├── Repository │ │ ├── Adnc.Shared.Repository.csproj │ │ ├── DapperEntities │ │ │ ├── LoginLog.cs │ │ │ └── OperationLog.cs │ │ ├── EfCoreEntities │ │ │ ├── Config │ │ │ │ └── EventTrackerConfig.cs │ │ │ └── EventTracker.cs │ │ └── GlobalUsings.cs │ ├── Shared │ │ ├── Adnc.Shared.csproj │ │ ├── ServiceInfo.cs │ │ ├── SystemConsts.cs │ │ └── UserContext.cs │ ├── WebApi │ │ ├── Adnc.Shared.WebApi.csproj │ │ ├── Authentication │ │ │ ├── AuthenticationBuilderExtensions.cs │ │ │ ├── Basic │ │ │ │ ├── BasicAuthenticationHandler.cs │ │ │ │ ├── BasicDefaults.cs │ │ │ │ ├── BasicEvents.cs │ │ │ │ ├── BasicPostConfigureOptions.cs │ │ │ │ ├── BasicSchemeOptions.cs │ │ │ │ └── BasicTokenValidatedContext.cs │ │ │ ├── Bearer │ │ │ │ ├── BearerAuthenticationHandler.cs │ │ │ │ ├── BearerDefaults.cs │ │ │ │ ├── JWTOptions.cs │ │ │ │ ├── JwtToken.cs │ │ │ │ ├── JwtTokenHelper.cs │ │ │ │ └── Tokens.cs │ │ │ ├── Hybrid │ │ │ │ ├── HybridAuthenticationHandler.cs │ │ │ │ ├── HybridDefaults.cs │ │ │ │ ├── HybridPostConfigureOptions.cs │ │ │ │ └── HybridSchemeOptions.cs │ │ │ └── Processors │ │ │ │ ├── AbstractAuthenticationProcessor.cs │ │ │ │ ├── BearerAuthenticationCacheProcessor.cs │ │ │ │ └── BearerAuthenticationRemoteProcessor.cs │ │ ├── Authorization │ │ │ ├── AdncAuthorizeAttribute.cs │ │ │ ├── AuthorizePolicy.cs │ │ │ ├── Handlers │ │ │ │ ├── AbstractPermissionHandler.cs │ │ │ │ ├── PermissionCacheHandler.cs │ │ │ │ └── PermissionRemoteHandler.cs │ │ │ └── PermissionRequirement.cs │ │ ├── Controller │ │ │ └── AdncControllerBase.cs │ │ ├── Extensions │ │ │ ├── HealthChecksBuilderExtension.cs │ │ │ ├── HostExtension.cs │ │ │ ├── JWTOptionsExtension.cs │ │ │ ├── ModelStateExtension.cs │ │ │ ├── ServiceCollectionExtension.cs │ │ │ ├── ServiceInfoExtension.cs │ │ │ ├── WebApplicationBuilderExtension.cs │ │ │ └── WebApplicationrExtension.cs │ │ ├── Filters │ │ │ └── CustomExceptionFilterAttribute.cs │ │ ├── GlobalUsings.cs │ │ ├── Middleware │ │ │ ├── CustomExceptionHandlerMiddleware.cs │ │ │ ├── RealIpMiddleware.cs │ │ │ └── SSOAuthenticationMiddleware.cs │ │ ├── Registrar │ │ │ ├── AbstractWebApiDependencyRegistrar.Authentication.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.Authorization.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.Controllers.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.Cors.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.MiniProfiler.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.SwaggerGen.cs │ │ │ ├── AbstractWebApiDependencyRegistrar.cs │ │ │ └── AbstractWebApiMiddlewareRegistrar.cs │ │ └── ThreadPoolSettings.cs │ └── logo.png ├── deploy_demo.sh ├── deploy_ocelot.sh └── logo.png └── test ├── Adnc.Infra.Unittest.sln ├── Unittest.Consul ├── Adnc.Infra.Unittest.Consul.csproj ├── Fixtures │ └── ConsulContextFixture.cs ├── GlobalUsings.cs ├── TestCases │ └── ConsulTests.cs └── appsettings.json ├── Unittest.Helper ├── Adnc.Infra.Unittest.Helper.csproj ├── GlobalUsings.cs └── TestCases │ ├── AES_Tests.cs │ ├── DES_Test.cs │ ├── HMACMD5_Tests.cs │ ├── HMACSHA_Tests.cs │ ├── HelperTests.cs │ ├── MD5_Tests.cs │ ├── RSA_Tests.cs │ └── SHA_Tests.cs ├── Unittest.Redis ├── Adnc.Infra.Unittest.Redis.csproj ├── Fixtures │ ├── FixtureConsts.cs │ └── RedisContextFixture.cs ├── GlobalUsings.cs ├── TestCases │ ├── IdGeneraterTests.cs │ └── RedisCahceTests.cs └── appsettings.json ├── Unittest.Repository.MongoDb ├── Adnc.Infra.Unittest.Reposity.MongoDb.csproj ├── Fixtures │ ├── EfCoreMongoDbcontextFixture.cs │ └── Entities │ │ ├── EntityInfoMongoDb.cs │ │ └── LoggerLog.cs ├── GlobalUsings.cs ├── TestCases │ └── MongoDbRepositoryTests.cs ├── adnc_cust_unittest.sql └── appsettings.json └── Unittest.Repository ├── Adnc.Infra.Unittest.Reposity.csproj ├── Fixtures ├── Dtos │ └── CustmerDto.cs ├── EfCoreDbcontextFixture.cs ├── Entities │ ├── Config │ │ ├── CustomerConfig.cs │ │ ├── CustomerFinanceConfig.cs │ │ ├── CustomerTransactionLogConfig.cs │ │ ├── EntityConsts.Cust.cs │ │ └── ProjectConfig.cs │ ├── Customer.cs │ ├── CustomerFinance.cs │ ├── CustomerTransactionLog.cs │ ├── EntityInfo.cs │ └── Project.cs ├── FixtureConsts.cs └── UnittestHelper.cs ├── GlobalUsings.cs ├── TestCases ├── EfCoreRepositoryTests.cs ├── ExpressionTests.cs ├── MaxscaleTests.cs └── TransactionTests.cs ├── adnc_cust_unittest.sql └── appsettings.json /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | bin 3 | obj 4 | txtlogs 5 | *.user 6 | *.pubxml 7 | *.diff 8 | .sonarqube 9 | .sonarlint 10 | .idea 11 | .vscode 12 | /README.html 13 | /.env/adnc -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "doc/devops"] 2 | path = doc/devops 3 | url = https://github.com/woyaodangrapper/adnc-devops 4 | -------------------------------------------------------------------------------- /doc/consul/consul-rg-adnc-sys.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": 3 | { 4 | "name": "adnc-api-sys-1", 5 | "tags": ["adnc-sys"], 6 | "address": "http://172.16.0.4", 7 | "port": 8001, 8 | "checks": [ 9 | { 10 | "http": "http://172.16.0.4:8001/health-24b01005-a76a-4b3b-8fb1-5e0f2e9564fb", 11 | "interval": "10s" 12 | }] 13 | } 14 | } -------------------------------------------------------------------------------- /doc/consul/demo/admin-api-appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=10.2.8.5;Port=13308;database=adnc_admin;uid=root;pwd=alpha.netcore;connection timeout=30;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:80" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:81", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /doc/consul/demo/cust-api-appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=10.2.8.5;Port=13308;database=adnc_cust;uid=root;pwd=alpha.netcore;connection timeout=30;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:80" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:81", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /doc/consul/demo/maint-api-appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=10.2.8.5;Port=13308;database=adnc_maint;uid=root;pwd=alpha.netcore;connection timeout=30;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:80" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:81", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /doc/consul/fabio.properties: -------------------------------------------------------------------------------- 1 | registry.consul.register.addr = 193.112.75.77:9998 2 | registry.consul.addr = 193.112.75.77:8550 3 | metrics.target = stdout 4 | -------------------------------------------------------------------------------- /doc/docker/docker-registry.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | docker pull registry:2.7.1 3 | 4 | docker run -d \ 5 | -p 5000:5000 \ 6 | --restart=always \ 7 | --name registry \ 8 | -v /root/data/docker-registry:/var/lib/registry \ 9 | registry:2.7.1 10 | ``` -------------------------------------------------------------------------------- /doc/dotmemory/install_dotmemory_in_container.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | #install 3 | docker exec -it aef2acae87dd /bin/bash 4 | cd / 5 | mkdir dotmemory 6 | cd dotmemory 7 | mkdir bin 8 | cd bin 9 | apt-get update -y 10 | apt-get install -y wget 11 | wget -O dotMemoryclt.zip https://www.nuget.org/api/v2/package/JetBrains.dotMemory.Console.linux-x64/2021.3.2 12 | apt-get install -y unzip && unzip dotMemoryclt.zip -d ./dotMemoryclt 13 | chmod +x -R dotMemoryclt/* 14 | 15 | #collecting 16 | apt-get update && apt-get install procps 17 | ps aux 18 | 19 | cd /dotmemory/bin/dotMemoryclt/tools 20 | ./dotMemory.sh get-snapshot 1 --save-to-dir=Snapshots 21 | exit 22 | 23 | #move dump file 24 | docker cp aef2acae87dd:/dotmemory/bin/dotMemoryclt/tools/Snapshots/[1]-dotnet.2023-05-19T22-54-53.166.dmw /dotmemory.dmw 25 | 26 | 27 | 28 | 29 | ``` 30 | 31 | -------------------------------------------------------------------------------- /doc/jenkins/vue/.dockerignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # local env files 5 | .env.local 6 | .env.*.local 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* -------------------------------------------------------------------------------- /doc/jenkins/vue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | MAINTAINER vueadmin 3 | ADD dist /usr/share/nginx/html 4 | ADD vueadmin.nginx.conf /etc/nginx/nginx.conf 5 | RUN chown nginx:nginx -R /usr/share/nginx/html 6 | EXPOSE 80 7 | RUN echo 'build adnc image successful!!' -------------------------------------------------------------------------------- /doc/jenkins/vue/stopcontainer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps|grep ${1}|while read i;do i; 3 | echo "容器已启动,详细信息:${i},即将关闭"; 4 | docker stop ${1}; 5 | docker rm ${1}; 6 | docker rmi ${2}; 7 | echo "已关闭容器,${1}" ; 8 | done; -------------------------------------------------------------------------------- /doc/k8s/adnc-usr-webapi-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 #指定api版本 2 | kind: ReplicaSet #指定创建资源的角色/类型 3 | metadata: 4 | name: adnc.usr.webapi 5 | spec: 6 | replicas: 3 #副本集数量 7 | selector: 8 | matchLabels: 9 | app: adnc.usr.webapi 10 | template: #pod模板 11 | metadata: #资源的元数据/属性 12 | labels: #标签定义 13 | app: adnc.usr.webapi #标签值 14 | spec: # 指定该资源的内容 15 | containers: #容器定义 16 | - name: adnc-usr-webapi #容器的名字 17 | imagePullPolicy: Never 18 | image: adnc-usr-webapi #容器镜像 -------------------------------------------------------------------------------- /doc/logo/ADNC_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/doc/logo/ADNC_05.png -------------------------------------------------------------------------------- /doc/loki/docker-compose.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/doc/loki/docker-compose.yml -------------------------------------------------------------------------------- /doc/loki/promtail.yml: -------------------------------------------------------------------------------- 1 | server: 2 | http_listen_port: 9080 3 | grpc_listen_port: 0 4 | 5 | positions: 6 | filename: /tmp/positions.yaml 7 | 8 | clients: 9 | - url: http://loki:3100/loki/api/v1/push 10 | 11 | scrape_configs: 12 | - job_name: system 13 | static_configs: 14 | - targets: 15 | - localhost 16 | labels: 17 | job: varlogs 18 | __path__: /var/log/*log 19 | -------------------------------------------------------------------------------- /doc/mariadb/log_seting.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | # 查看日志是否开启 3 | show variables like 'general_log'; 4 | # 查看日志输出类型 table或file 5 | show variables like 'log_output'; 6 | # 查看日志文件保存位置 7 | show variables like 'general_log_file'; 8 | # 设置日志文件保存位置 9 | set global general_log_file='/tmp/general_log'; 10 | # 开启日志功能 11 | set global general_log=on; 12 | # 设置输出类型为 table 13 | set global log_output='table'; 14 | # 设置输出类型为file 15 | set global log_output='file'; 16 | #清空mysql默认数据库 genral_log 表数据 17 | truncate table mysql.general_log; 18 | #转移表数据 genral_log->genral_log_bak 19 | create table mysql.general_log_bak as select * from mysql.; 20 | #查询日志 21 | SELECT * FROM mysql.general_log where user_host='root[root] @ [223.73.185.137]' order by event_time desc limit 0,100 22 | ``` -------------------------------------------------------------------------------- /doc/mariadb/order_of_execution_of_sql.md: -------------------------------------------------------------------------------- 1 | ```sql 2 | -- 7 3 | select customer.id,sum(customerfinance.balance) amout 4 | -- 1 5 | from customer 6 | -- 3 7 | inner join customerfinance 8 | -- 2 9 | on customer.id = customerfinance.id 10 | -- 4 11 | where customer.id>305822786048000 12 | -- 5 13 | group by customer.id 14 | -- 6 15 | having sum(customerfinance.balance)>0 16 | -- 8 17 | order by customer.id,amout 18 | -- 9 19 | limit 0,1 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /doc/mongodb/readme.md: -------------------------------------------------------------------------------- 1 |
2 | Adnc是一个微服务开发框架 代码改变世界 开源推动社区 3 |
4 | 5 | # mongodb安装与配置 6 | 7 | ``` 8 | docker pull mongo:4.4.3 9 | docker run --name mongo -p 13017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=football -e TZ=Asia/Shanghai -v /root/data/mongo:/data/db -v /root/data/mongo/backup:/data/backup -d mongo:4.4.3 --auth 10 | 进入mongo容器 11 | docker exec -it mongo mongo admin 12 | use admin 13 | db.auth("admin","football") 14 | # 新建logs_dev数据库 15 | use logs_dev 16 | # 创建用户 17 | db.createUser({user:'alpha',pwd:'football',roles:[{role:'readWrite',db:'logs_dev'}]}) 18 | ``` -------------------------------------------------------------------------------- /doc/mycat/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-stretch 2 | 3 | ADD http://dl.mycat.org.cn/1.6.7.6/20201126013625/Mycat-server-1.6.7.6-release-20201126013625-linux.tar.gz /usr/local 4 | RUN cd /usr/local && tar -zxvf Mycat-server-1.6.7.6-release-20201126013625-linux.tar.gz && ls -lna 5 | 6 | ENV MYCAT_HOME=/usr/local/mycat 7 | WORKDIR /usr/local/mycat 8 | 9 | ENV TZ Asia/Shanghai 10 | 11 | EXPOSE 8066 9066 12 | 13 | CMD ["/usr/local/mycat/bin/mycat", "console","&"] -------------------------------------------------------------------------------- /doc/sonarqube/readme.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | --安装服务端 3 | --https://www.cnblogs.com/7tiny/p/11342902.html 4 | mkdir /root/sonarqube 5 | cd /root/sonarqube 6 | docker run -d --name sonarqube \ 7 | -v /root/sonarqube/conf:/opt/sonarqube/conf \ 8 | -v /root/sonarqube/data:/opt/sonarqube/data \ 9 | -v /root/sonarqube/logs:/opt/sonarqube/logs \ 10 | -v /root/sonarqube/extensions:/opt/sonarqube/extensions \ 11 | -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true \ 12 | -p 19000:9000 \ 13 | sonarqube:8.9.0-community 14 | 15 | --VS-NUGET 16 | dotnet tool install --global dotnet-sonarscanner 17 | 18 | dotnet sonarscanner begin /k:"adnc" /d:sonar.host.url="http://193.112.75.77:9000" /d:sonar.login="a5649ec24aaa79f4934bbe959b346af6cc079aad" 19 | 20 | dotnet build 21 | 22 | dotnet sonarscanner end /d:sonar.login="a5649ec24aaa79f4934bbe959b346af6cc079aad" 23 | ``` -------------------------------------------------------------------------------- /src/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /src/Delete-BIN-OBJ-Folders.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | cls 3 | 4 | ECHO Deleting all BIN and OBJ folders... 5 | ECHO. 6 | 7 | FOR /d /r . %%d in (bin,obj) DO ( 8 | IF EXIST "%%d" ( 9 | ECHO %%d | FIND /I "\node_modules\" > Nul && ( 10 | ECHO.Skipping: %%d 11 | ) || ( 12 | ECHO.Deleting: %%d 13 | rd /s/q "%%d" 14 | ) 15 | ) 16 | ) 17 | 18 | ECHO. 19 | ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit. 20 | pause > nul -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/Authentication/BearerAuthenticationLocalProcessor.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.WebApi.Authentication.Processors; 2 | 3 | namespace Adnc.Demo.Admin.Api.Authentication; 4 | 5 | [Obsolete($"use {nameof(BearerAuthenticationCacheProcessor)} instead 2025-02-17")] 6 | public class BearerAuthenticationLocalProcessor(IUserService userAppService) : AbstractAuthenticationProcessor 7 | { 8 | protected override async Task<(string? ValidationVersion, bool Status)> GetValidatedInfoAsync(long userId) 9 | { 10 | var validatedInfo = await userAppService.GetUserValidatedInfoAsync(userId); 11 | if (validatedInfo is null) 12 | { 13 | return (null, false); 14 | } 15 | 16 | return (validatedInfo.ValidationVersion, validatedInfo.Status); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.IdentityModel.Tokens.Jwt; 2 | global using Adnc.Demo.Admin.Application.Contracts.Dtos; 3 | global using Adnc.Demo.Admin.Application.Contracts.Services; 4 | global using Adnc.Demo.Const; 5 | global using Adnc.Demo.Const.Permissions.Admin; 6 | global using Adnc.Shared; 7 | global using Adnc.Shared.Application.Contracts.Dtos; 8 | global using Adnc.Shared.WebApi; 9 | global using Adnc.Shared.WebApi.Authentication.Bearer; 10 | global using Adnc.Shared.WebApi.Authorization; 11 | global using Microsoft.AspNetCore.Authorization; 12 | global using Microsoft.AspNetCore.Mvc; 13 | global using Microsoft.Extensions.Options; 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/MiddlewareRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Demo.Admin.Api.Grpc; 2 | using Adnc.Shared.WebApi.Registrar; 3 | 4 | namespace Adnc.Demo.Admin.Api; 5 | 6 | public sealed class MiddlewareRegistrar(WebApplication app) : AbstractWebApiMiddlewareRegistrar(app) 7 | { 8 | public override void UseAdnc() 9 | { 10 | UseWebApiDefault(endpointRoute: endpoint => 11 | { 12 | endpoint.MapGrpcService(); 13 | }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Demo.Admin.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "File", 3 | "Mysql": { 4 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_admin;uid=root;pwd=alpha.netcore;connection timeout=30;" 5 | }, 6 | "Kestrel": { 7 | "Endpoints": { 8 | "Default": { 9 | "Url": "http://0.0.0.0:50010" 10 | }, 11 | "Grpc": { 12 | "Url": "http://0.0.0.0:50011", 13 | "Protocols": "Http2" 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/shared/appsettings,adnc/production/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/shared/appsettings,adnc/staging/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/shared/appsettings,adnc/test/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DictCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class DictCreationDto : InputDto 4 | { 5 | public string Code { get; set; } = string.Empty; 6 | 7 | public string Name { get; set; } = string.Empty; 8 | 9 | public string Remark { get; set; } = string.Empty; 10 | 11 | public bool Status { get; set; } 12 | } 13 | 14 | public class DictDataCreationDto : InputDto 15 | { 16 | public string DictCode { get; set; } = string.Empty; 17 | 18 | public string Label { get; set; } = string.Empty; 19 | 20 | public string Value { get; set; } = string.Empty; 21 | 22 | public string TagType { get; set; } = string.Empty; 23 | 24 | public bool Status { get; set; } 25 | 26 | public int Ordinal { get; set; } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DictDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | [Serializable] 4 | public class DictDto : DictCreationDto 5 | { 6 | public long Id { get; set; } 7 | } 8 | 9 | [Serializable] 10 | public class DictDataDto : DictDataCreationDto 11 | { 12 | public long Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DictOptionDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | [Serializable] 4 | public class DictOptionDto 5 | { 6 | public string Name { get; set; } = string.Empty; 7 | 8 | public string Code { get; set; } = string.Empty; 9 | 10 | public DictDataOption[] DictDataList { get; set; } = []; 11 | 12 | [Serializable] 13 | public class DictDataOption 14 | { 15 | public string Label { get; set; } = string.Empty; 16 | 17 | public string Value { get; set; } = string.Empty; 18 | 19 | public string TagType { get; set; } = string.Empty; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DictSearchPagedDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 字典数据检索条件 5 | /// 6 | public class DictDataSearchPagedDto : SearchPagedDto 7 | { 8 | public string? DictCode { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DictUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class DictUpdationDto : DictCreationDto 4 | { } 5 | 6 | public class DictDataUpdationDto : DictDataCreationDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Dict/DtoValidators/DictUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class DictUpdationDtoValidator : AbstractValidator 4 | { 5 | public DictUpdationDtoValidator() 6 | { 7 | Include(new DictCreationDtoValidator()); 8 | } 9 | } 10 | 11 | public class DictDataUpdationDtoValidator : AbstractValidator 12 | { 13 | public DictDataUpdationDtoValidator() 14 | { 15 | Include(new DictDataCreationDtoValidator()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/DtoValidators/MenuCreationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class MenuCreationDtoValidator : AbstractValidator 4 | { 5 | public MenuCreationDtoValidator() 6 | { 7 | RuleFor(x => x.Perm).MaximumLength(MenuConsts.Code_MaxLength); 8 | RuleFor(x => x.Name).NotEmpty().Length(2, MenuConsts.Name_MaxLength); 9 | RuleFor(x => x.Component).MaximumLength(MenuConsts.Component_MaxLength); 10 | RuleFor(x => x.Icon).MaximumLength(MenuConsts.Icon_MaxLength); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/DtoValidators/MenuUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class MenuUpdationDtoValidator : AbstractValidator 4 | { 5 | public MenuUpdationDtoValidator() 6 | { 7 | Include(new MenuCreationDtoValidator()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/MenuDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 菜单 5 | /// 6 | [Serializable] 7 | public class MenuDto : MenuCreationDto 8 | { 9 | /// 10 | /// 菜单Id 11 | /// 12 | public long Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/MenuTreeDto.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 4 | 5 | /// 6 | /// 菜单 7 | /// 8 | [Serializable] 9 | public class MenuTreeDto : MenuDto 10 | { 11 | /// 12 | /// 子菜单 13 | /// 14 | [JsonPropertyOrder(100)] 15 | public List Children { get; set; } = []; 16 | } 17 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/MenuTypeEnum.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 菜单 5 | /// 6 | public enum MenuType 7 | { 8 | CATALOG = 1001, 9 | MENU = 1002, 10 | BUTTON = 1004, 11 | EXTLINK = 1008, 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Menu/MenuUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 菜单 5 | /// 6 | public class MenuUpdationDto : MenuCreationDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Notice/NoticeSearchPagedDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 通知 5 | /// 6 | public class NoticeSearchPagedDto : SearchPagedDto 7 | { 8 | public string? Title { get; set; } 9 | 10 | public int? PublishStatus { get; set; } 11 | 12 | public int? IsRead { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Organization/DtoValidators/OrganizationUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | /// 4 | /// DeptUpdationDtoValidator 5 | /// 6 | public class DeptUpdationDtoValidator : AbstractValidator 7 | { 8 | /// 9 | /// DeptUpdationDtoValidator 10 | /// 11 | public DeptUpdationDtoValidator() 12 | { 13 | Include(new DeptCreationDtoValidator()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Organization/OrganizationCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 部门 5 | /// 6 | public class OrganizationCreationDto : InputDto 7 | { 8 | /// 9 | /// 父级Id 10 | /// 11 | public long ParentId { get; set; } 12 | 13 | /// 14 | /// 部门编号 15 | /// 16 | public string Code { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 部门全称 20 | /// 21 | public string Name { get; set; } = string.Empty; 22 | 23 | /// 24 | /// 部门状态 25 | /// 26 | public bool Status { get; set; } 27 | 28 | /// 29 | /// 序号 30 | /// 31 | public int Ordinal { get; set; } 32 | } 33 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Organization/OrganizationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 部门 5 | /// 6 | [Serializable] 7 | public class OrganizationDto : OrganizationCreationDto 8 | { 9 | /// 10 | /// 部门Id 11 | /// 12 | public long Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Organization/OrganizationTreeDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 部门树 5 | /// 6 | [Serializable] 7 | public class OrganizationTreeDto : OrganizationDto 8 | { 9 | public List Children { get; set; } = []; 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Organization/OrganizationUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 部门 5 | /// 6 | public class OrganizationUpdationDto : OrganizationCreationDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/DtoValidators/RoleCreationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class RoleCreationDtoValidator : AbstractValidator 4 | { 5 | public RoleCreationDtoValidator() 6 | { 7 | RuleFor(x => x.Name).NotEmpty().Length(2, RoleConsts.Name_MaxLength); 8 | RuleFor(x => x.Code).NotEmpty().Length(2, RoleConsts.Code_MaxLength); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/DtoValidators/RoleSetPermissonsDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class RoleSetPermissonsDtoValidator : AbstractValidator 4 | { 5 | public RoleSetPermissonsDtoValidator() 6 | { 7 | RuleFor(x => x.RoleId).GreaterThan(0); 8 | RuleFor(x => x.Permissions).NotNull(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/DtoValidators/RoleUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class RoleUpdationDtoValidator : AbstractValidator 4 | { 5 | public RoleUpdationDtoValidator() 6 | { 7 | Include(new RoleCreationDtoValidator()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class RoleCreationDto : InputDto 4 | { 5 | /// 6 | /// 角色名 7 | /// 8 | public string Name { get; set; } = string.Empty; 9 | 10 | /// 11 | /// 角色代码 12 | /// 13 | public string Code { get; set; } = string.Empty; 14 | 15 | /// 16 | /// 角色状态 17 | /// 18 | public bool Status { get; set; } 19 | 20 | /// 21 | /// 数据范围 22 | /// 23 | public int DataScope { get; set; } 24 | 25 | /// 26 | /// 序号 27 | /// 28 | public int Ordinal { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 角色 5 | /// 6 | [Serializable] 7 | public class RoleDto : RoleCreationDto 8 | { 9 | /// 10 | /// 角色Id 11 | /// 12 | public long Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleMenuCodeDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 角色,权限 5 | /// 6 | [Serializable] 7 | public class RoleMenuCodeDto : IDto 8 | { 9 | /// 10 | /// 角色Id 11 | /// 12 | public long RoleId { get; set; } 13 | 14 | /// 15 | /// 权限代码 16 | /// 17 | public string[] Perms { get; set; } = []; 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleMenuRelationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 菜单-角色关联 5 | /// 6 | [Serializable] 7 | public class RoleMenuRelationDto : IDto 8 | { 9 | /// 10 | /// 菜单Id 11 | /// 12 | public long MenuId { get; set; } 13 | 14 | /// 15 | /// 角色Id 16 | /// 17 | public long RoleId { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleSetPermissonsDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class RoleSetPermissonsDto : IDto 4 | { 5 | public long RoleId { set; get; } 6 | public long[] Permissions { get; set; } = []; 7 | } 8 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/Role/RoleUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class RoleUpdationDto : RoleCreationDto 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/DtoValidators/SysConfigCreationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class SysConfigCreationDtoValidator : AbstractValidator 4 | { 5 | public SysConfigCreationDtoValidator() 6 | { 7 | RuleFor(x => x.Key).NotEmpty().Length(2, SysConfigConsts.Key_MaxLength); 8 | RuleFor(x => x.Name).NotEmpty().Length(2, SysConfigConsts.Name_MaxLength); 9 | RuleFor(x => x.Value).NotEmpty().Length(2, SysConfigConsts.Value_MaxLength); 10 | RuleFor(x => x.Remark).MaximumLength(SysConfigConsts.Remark_MaxLength); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/DtoValidators/SysConfigUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class SysConfigUpdationDtoValidator : AbstractValidator 4 | { 5 | public SysConfigUpdationDtoValidator() 6 | { 7 | Include(new SysConfigCreationDtoValidator()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/SysConfigCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 系统配置 5 | /// 6 | public class SysConfigCreationDto : InputDto 7 | { 8 | /// 9 | /// 参数键 10 | /// 11 | public string Key { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 参数名 15 | /// 16 | public string Name { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 参数值 20 | /// 21 | public string Value { get; set; } = string.Empty; 22 | 23 | /// 24 | /// 备注 25 | /// 26 | public string Remark { get; set; } = string.Empty; 27 | } 28 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/SysConfigDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 系统配置 5 | /// 6 | [Serializable] 7 | public class SysConfigDto : SysConfigCreationDto 8 | { 9 | /// 10 | /// 参数Id 11 | /// 12 | public long Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/SysConfigSimpleDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 系统配置 5 | /// 6 | [Serializable] 7 | public class SysConfigSimpleDto 8 | { 9 | /// 10 | /// 参数键 11 | /// 12 | public string Key { get; set; } = string.Empty; 13 | 14 | /// 15 | /// 参数名 16 | /// 17 | public string Name { get; set; } = string.Empty; 18 | 19 | /// 20 | /// 参数值 21 | /// 22 | public string Value { get; set; } = string.Empty; 23 | } 24 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/SysConfig/SysConfigUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 系统配置 5 | /// 6 | public class SysConfigUpdationDto : SysConfigCreationDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserChangeProfileDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserChangeProfileDtoValidator : AbstractValidator 4 | { 5 | public UserChangeProfileDtoValidator() 6 | { 7 | RuleFor(x => x.Name).Length(2, UserConsts.Name_Maxlength); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserChangePwdDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserChangePwdDtoValidator : AbstractValidator 4 | { 5 | public UserChangePwdDtoValidator() 6 | { 7 | RuleFor(x => x.OldPassword).NotEmpty(); 8 | RuleFor(x => x.NewPassword).NotEmpty().Length(5, UserConsts.Password_Maxlength); 9 | RuleFor(x => x.ConfirmPassword).NotEmpty().Length(5, UserConsts.Password_Maxlength) 10 | .Must((dto, rePassword) => 11 | { 12 | return dto.NewPassword == rePassword; 13 | }) 14 | .WithMessage("重复密码必须跟新密码一样"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserCreationAndUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserCreationAndUpdationDtoValidator : AbstractValidator 4 | { 5 | public UserCreationAndUpdationDtoValidator() 6 | { 7 | RuleFor(x => x.Name).Required().Length(2, UserConsts.Name_Maxlength); 8 | RuleFor(x => x.Email).Required().MaximumLength(UserConsts.Email_Maxlength).EmailAddress(); 9 | RuleFor(x => x.Mobile).Phone(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserCreationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserCreationDtoValidator : AbstractValidator 4 | { 5 | public UserCreationDtoValidator() 6 | { 7 | Include(new UserCreationAndUpdationDtoValidator()); 8 | RuleFor(x => x.Account).Required().LetterNumberUnderscode().Length(5, UserConsts.Account_MaxLength); 9 | //RuleFor(x => x.Password).NotEmpty().When(x => x.Id < 1) 10 | // .Length(5, 16).When(x => x.Id < 1); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserLoginDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserLoginDtoValidator : AbstractValidator 4 | { 5 | public UserLoginDtoValidator() 6 | { 7 | RuleFor(x => x.Account).Required().Length(5, UserConsts.Account_MaxLength).LetterNumberUnderscode(); 8 | RuleFor(x => x.Password).Required().Length(5, UserConsts.Password_Maxlength); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/DtoValidators/UserUpdationDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.DtoValidators; 2 | 3 | public class UserUpdationDtoValidator : AbstractValidator 4 | { 5 | public UserUpdationDtoValidator() 6 | { 7 | Include(new UserCreationAndUpdationDtoValidator()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class UserCreationDto : UserCreationAndUpdationDto 4 | { 5 | /// 6 | /// 账户 7 | /// 8 | public string Account { get; set; } = string.Empty; 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 用户 5 | /// 6 | [Serializable] 7 | public class UserDto : UserCreationAndUpdationDto 8 | { 9 | /// 10 | /// 用户Id 11 | /// 12 | public long Id { get; set; } 13 | 14 | /// 15 | /// 用户账号 16 | /// 17 | public string Account { get; set; } = string.Empty; 18 | 19 | /// 20 | /// 部门名称 21 | /// 22 | public string DeptName { get; set; } = string.Empty; 23 | 24 | /// 25 | /// 创建时间/注册时间 26 | /// 27 | public DateTime CreateTime { get; set; } 28 | } 29 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserLoginDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 登录信息 5 | /// 6 | public class UserLoginDto : InputDto 7 | { 8 | /// 9 | /// 账户 10 | /// 11 | public string Account { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 密码 15 | /// 16 | public string Password { get; set; } = string.Empty; 17 | } 18 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserRefreshTokenDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 刷新Token实体 5 | /// 6 | public class UserRefreshTokenDto : InputDto 7 | { 8 | /// 9 | /// RefreshToken 10 | /// 11 | public string RefreshToken { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserSearchPagedDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 用户检索条件 5 | /// 6 | public class UserSearchPagedDto : SearchPagedDto 7 | { 8 | /// 9 | /// 用户状态 10 | /// 11 | public bool? Status { get; set; } 12 | 13 | /// 14 | /// 部门编号 15 | /// 16 | public long? DeptId { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/Dtos/User/UserUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | 3 | public class UserUpdationDto : UserCreationAndUpdationDto 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application.Contracts/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Demo.Admin.Application.Contracts.Dtos; 2 | global using Adnc.Demo.Const.Caching.Admin; 3 | global using Adnc.Demo.Const.Entity.Admin; 4 | global using Adnc.Infra.Redis.Caching.Core.Interceptor; 5 | global using Adnc.Infra.Repository.Interceptor; 6 | global using Adnc.Shared; 7 | global using Adnc.Shared.Application.Contracts.Attributes; 8 | global using Adnc.Shared.Application.Contracts.Dtos; 9 | global using Adnc.Shared.Application.Contracts.Interfaces; 10 | global using Adnc.Shared.Application.Contracts.ResultModels; 11 | global using Adnc.Shared.Application.Contracts.Validators; 12 | global using FluentValidation; 13 | 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Application/Adnc.Demo.Admin.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Config/OrganizationConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities.Config; 2 | 3 | public class DetpConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | 9 | builder.Property(x => x.Name).HasMaxLength(DeptConsts.Name_MaxLength); 10 | builder.Property(x => x.Code).HasMaxLength(DeptConsts.Code_MaxLength); 11 | builder.Property(x => x.ParentIds).HasMaxLength(DeptConsts.Pids_MaxLength); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Config/RoleConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities.Config; 2 | 3 | public class RoleConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | 9 | builder.Property(x => x.Name).HasMaxLength(RoleConsts.Name_MaxLength); 10 | builder.Property(x => x.Code).HasMaxLength(RoleConsts.Code_MaxLength); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Config/RoleMenuRelationConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities.Config; 2 | 3 | public class RoleMenuRelationConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Config/RoleUserRelationConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities.Config; 2 | 3 | public class RoleUserRelationConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Config/SysConfigConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities.Config; 2 | 3 | public class SysConfigConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | 9 | builder.Property(x => x.Key).HasMaxLength(SysConfigConsts.Key_MaxLength); 10 | builder.Property(x => x.Name).HasMaxLength(SysConfigConsts.Name_MaxLength); 11 | builder.Property(x => x.Value).HasMaxLength(SysConfigConsts.Value_MaxLength); 12 | builder.Property(x => x.Remark).HasMaxLength(SysConfigConsts.Remark_MaxLength); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Organization.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities; 2 | 3 | /// 4 | /// 部门 5 | /// 6 | public class Organization : EfFullAuditEntity 7 | { 8 | public long ParentId { get; set; } 9 | 10 | public string ParentIds { get; set; } = string.Empty; 11 | 12 | public string Code { get; set; } = string.Empty; 13 | 14 | public string Name { get; set; } = string.Empty; 15 | 16 | public bool Status { get; set; } 17 | 18 | public int Ordinal { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/Role.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities; 2 | 3 | /// 4 | /// 角色 5 | /// 6 | public class Role : EfFullAuditEntity 7 | { 8 | public string Name { get; set; } = string.Empty; 9 | 10 | public string Code { get; set; } = string.Empty; 11 | 12 | public int DataScope { get; set; } 13 | 14 | public bool Status { get; set; } 15 | 16 | public int Ordinal { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/RoleMenuRelation.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities; 2 | 3 | /// 4 | /// 菜单角色关系 5 | /// 6 | public class RoleMenuRelation : EfEntity 7 | { 8 | public long MenuId { get; set; } 9 | 10 | public long RoleId { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/RoleUserRelation.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities; 2 | 3 | /// 4 | /// 用户角色关系 5 | /// 6 | public class RoleUserRelation : EfEntity 7 | { 8 | public long UserId { get; set; } 9 | 10 | public long RoleId { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Entities/SysConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Admin.Repository.Entities; 2 | 3 | /// 4 | /// 系统参数 5 | /// 6 | public class SysConfig : EfFullAuditEntity 7 | { 8 | /// 9 | /// 参数键 10 | /// 11 | public string Key { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 参数名 15 | /// 16 | public string Name { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 参数值 20 | /// 21 | public string Value { get; set; } = string.Empty; 22 | 23 | /// 24 | /// 备注 25 | /// 26 | public string Remark { get; set; } = string.Empty; 27 | } 28 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Reflection; 2 | global using Adnc.Demo.Admin.Repository.Entities; 3 | global using Adnc.Demo.Const.Entity.Admin; 4 | global using Adnc.Infra.Repository; 5 | global using Adnc.Infra.Repository.EfCore; 6 | global using Adnc.Shared.Repository.EfCoreEntities; 7 | global using Microsoft.EntityFrameworkCore; 8 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 9 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Migrations/20250317153239_Update2025031702.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Adnc.Demo.Admin.Repository.Migrations; 6 | 7 | /// 8 | public partial class Update2025031702 : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Demo/Admin/Admin.Repository/Migrations/20250323101948_Update25032301.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Adnc.Demo.Admin.Repository.Migrations; 6 | 7 | /// 8 | public partial class Update25032301 : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Application/Dtos/CustomerCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Application.Dtos; 2 | 3 | public class CustomerCreationDto : InputDto 4 | { 5 | public string Account { get; set; } = string.Empty; 6 | 7 | public string Nickname { get; set; } = string.Empty; 8 | 9 | public string Realname { get; set; } = string.Empty; 10 | 11 | public string Password { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Application/Dtos/CustomerDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Application.Dtos; 2 | 3 | public class CustomerDto : OutputBaseAuditDto 4 | { 5 | public string Account { get; set; } = string.Empty; 6 | 7 | public string Nickname { get; set; } = string.Empty; 8 | 9 | public string Realname { get; set; } = string.Empty; 10 | 11 | public decimal Balance { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Application/Dtos/CustomerRechargeDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Application.Dtos; 2 | 3 | public class CustomerRechargeDto : InputDto 4 | { 5 | public decimal Amount { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Application/Dtos/DtoValidators/CustomerRechargeDtoValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Application.Dtos.DtoValidators; 2 | 3 | public class CustomerRechargeDtoValidator : AbstractValidator 4 | { 5 | public CustomerRechargeDtoValidator() 6 | { 7 | RuleFor(x => x.Amount).NotEqual(0).WithMessage("充值金额不能等于{ComparisonValue}"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Application/Dtos/TransactionLogDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Application.Dtos; 2 | 3 | public class TransactionLogDto : OutputDto 4 | { 5 | public long CustomerId { get; set; } 6 | 7 | public string Account { get; set; } = string.Empty; 8 | 9 | public int ExchangeType { get; set; } 10 | 11 | public string ExchangeTypeName { get; set; } = string.Empty; 12 | 13 | public int ExchageStatus { get; set; } 14 | 15 | public string ExchageStatusName { get; set; } = string.Empty; 16 | 17 | public decimal ChangingAmount { get; set; } 18 | 19 | public decimal Amount { get; set; } 20 | 21 | public decimal ChangedAmount { get; set; } 22 | 23 | public string Remark { get; set; } = string.Empty; 24 | 25 | public DateTime CreateTime { get; set; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/MapperProfile.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api; 2 | 3 | public class CustProfile : Profile 4 | { 5 | public CustProfile() 6 | { 7 | CreateMap(typeof(PagedModel<>), typeof(PageModelDto<>)).ForMember("XData", opt => opt.Ignore()); 8 | CreateMap(); 9 | CreateMap(); 10 | CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/MiddlewareRegistrar.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api; 2 | 3 | public sealed class MiddlewareRegistrar(WebApplication app) : AbstractWebApiMiddlewareRegistrar(app) 4 | { 5 | public override void UseAdnc() 6 | { 7 | UseWebApiDefault(); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Migrations/20250323102232_Update25032301.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Adnc.Demo.Cust.Api.Migrations; 6 | 7 | /// 8 | public partial class Update25032301 : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | 14 | } 15 | 16 | /// 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Demo.Cust.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Repository/Entities/Config/FinanceConfig.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Demo.Const.Entity.Cust; 2 | 3 | namespace Adnc.Demo.Cust.Api.Repository.Entities.Config; 4 | 5 | public class FinanceConfig : AbstractEntityTypeConfiguration 6 | { 7 | public override void Configure(EntityTypeBuilder builder) 8 | { 9 | base.Configure(builder); 10 | 11 | builder.Property(x => x.Account).HasMaxLength(CustomerFinanceConsts.Account_MaxLength); 12 | builder.Property(x => x.Balance).HasColumnType("decimal(18,4)"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Repository/Entities/Customer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Repository.Entities; 2 | 3 | /// 4 | /// 客户表 5 | /// 6 | public class Customer : EfFullAuditEntity 7 | { 8 | public string Account { get; set; } = string.Empty; 9 | 10 | public string Password { get; set; } = string.Empty; 11 | 12 | public string Nickname { get; set; } = string.Empty; 13 | 14 | public string Realname { get; set; } = string.Empty; 15 | 16 | public virtual required Finance FinanceInfo { get; set; } 17 | 18 | public virtual ICollection? TransactionLogs { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Repository/Entities/EntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Repository.Entities; 2 | 3 | public class EntityInfo : AbstractEntityInfo 4 | { 5 | protected override List GetEntityAssemblies() => [GetType().Assembly, typeof(EventTracker).Assembly]; 6 | 7 | protected override void SetTableName(ModelBuilder modelBuilder) 8 | { 9 | modelBuilder.Entity().ToTable("cust_eventtracker"); 10 | modelBuilder.Entity().ToTable("cust_customer"); 11 | modelBuilder.Entity().ToTable("cust_finance"); 12 | modelBuilder.Entity().ToTable("cust_transactionlog"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/Repository/Entities/Finance.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Cust.Api.Repository.Entities; 2 | 3 | /// 4 | /// 客户财务表 5 | /// 6 | public class Finance : EfFullAuditEntity, IConcurrency 7 | { 8 | public string Account { get; set; } = string.Empty; 9 | 10 | public decimal Balance { get; set; } 11 | 12 | public byte[] RowVersion { get; set; } = default!; 13 | } 14 | -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_cust;uid=root;pwd=alpha.netcore;connection timeout=10;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:50030" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:50031", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/shared/appsettings,adnc/production/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/shared/appsettings,adnc/staging/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/shared/appsettings,adnc/test/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Cust/Cust.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/Adnc.Demo.Maint.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 运维中心服务 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Demo.Const; 2 | global using Adnc.Demo.Const.Permissions.Maint; 3 | global using Adnc.Demo.Maint.Application.Dtos; 4 | global using Adnc.Demo.Maint.Application.Services; 5 | global using Adnc.Shared; 6 | global using Adnc.Shared.Application.Contracts.Dtos; 7 | global using Adnc.Shared.WebApi; 8 | global using Adnc.Shared.WebApi.Authorization; 9 | global using Microsoft.AspNetCore.Mvc; 10 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/MiddlewareRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.WebApi.Registrar; 2 | 3 | namespace Adnc.Demo.Maint.Api; 4 | 5 | public sealed class MiddlewareRegistrar(WebApplication app) : AbstractWebApiMiddlewareRegistrar(app) 6 | { 7 | public override void UseAdnc() 8 | { 9 | UseWebApiDefault(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Demo.Maint.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_maint;uid=root;pwd=alpha.netcore;connection timeout=10;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:50020" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:50021", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/shared/appsettings,adnc/production/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/shared/appsettings,adnc/staging/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/shared/appsettings,adnc/test/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Application/Adnc.Demo.Maint.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Application/Dtos/LoginLogDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Maint.Application.Dtos; 2 | 3 | /// 4 | /// 登录日志 5 | /// 6 | public class LoginLogDto : LoginLog 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Application/Dtos/OperationLogDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Maint.Application.Dtos; 2 | 3 | /// 4 | /// 操作日志 5 | /// 6 | public class OperationLogDto : OperationLog 7 | { } 8 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Application/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Reflection; 2 | global using Adnc.Demo.Maint.Application.Dtos; 3 | global using Adnc.Demo.Maint.Repository; 4 | global using Adnc.Infra.Repository; 5 | global using Adnc.Shared; 6 | global using Adnc.Shared.Application.Contracts.Dtos; 7 | global using Adnc.Shared.Application.Contracts.Interfaces; 8 | global using Adnc.Shared.Application.Registrar; 9 | global using Adnc.Shared.Application.Services; 10 | global using Adnc.Shared.Repository.DapperEntities; 11 | global using AutoMapper; 12 | global using Microsoft.Extensions.DependencyInjection; 13 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Application/MapperProfile.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Maint.Application; 2 | 3 | public class MaintProfile : Profile 4 | { 5 | public MaintProfile() 6 | { 7 | CreateMap(typeof(PagedModel<>), typeof(PageModelDto<>)).ForMember("XData", opt => opt.Ignore()); 8 | CreateMap(); 9 | CreateMap(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Maint/Maint.Repository/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Core.DependencyInjection; 2 | global using Adnc.Infra.Repository; 3 | global using Adnc.Shared; 4 | global using Microsoft.Extensions.Configuration; 5 | global using Microsoft.Extensions.DependencyInjection; 6 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/Adnc.Demo.Ord.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 订单中心服务 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Demo.Ord.Application.Dtos; 2 | global using Adnc.Demo.Ord.Application.Services; 3 | global using Adnc.Shared; 4 | global using Adnc.Shared.Application.Contracts.Dtos; 5 | global using Adnc.Shared.WebApi; 6 | global using Microsoft.AspNetCore.Mvc; 7 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/MiddlewareRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.WebApi.Registrar; 2 | 3 | namespace Adnc.Demo.Ord.Api; 4 | 5 | public sealed class MiddlewareRegistrar(WebApplication app) : AbstractWebApiMiddlewareRegistrar(app) 6 | { 7 | public override void UseAdnc() 8 | { 9 | UseWebApiDefault(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Demo.Ord.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_ord;uid=root;pwd=alpha.netcore;connection timeout=10;" 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:50040" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:50041", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/shared/appsettings,adnc/production/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/shared/appsettings,adnc/staging/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/shared/appsettings,adnc/test/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Adnc.Demo.Ord.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Cache/CacheService.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Infra.Redis.Caching.Core.Preheater; 2 | 3 | namespace Adnc.Demo.Ord.Application.Cahce; 4 | 5 | public class CacheService(Lazy cacheProvider, Lazy serviceProvider) : AbstractCacheService(cacheProvider, serviceProvider), ICachePreheatable 6 | { 7 | public override async Task PreheatAsync() => await Task.CompletedTask; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Dtos/OrderCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application.Dtos; 2 | 3 | public class OrderCreationDto : IDto 4 | { 5 | /// 6 | /// 客户Id 7 | /// 8 | public long CustomerId { get; set; } 9 | 10 | /// 11 | /// 备注 12 | /// 13 | public string Remark { get; set; } = string.Empty; 14 | 15 | /// 16 | /// 收货信息 17 | /// 18 | public OrderReceiverDto DeliveryInfomaton { get; set; } = default!; 19 | 20 | /// 21 | /// 订单子项 22 | /// 23 | public virtual ICollection Items { get; set; } = []; 24 | 25 | public class OrderCreationItemDto : IDto 26 | { 27 | public long ProductId { get; set; } 28 | 29 | public int Count { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Dtos/OrderMarkCreatedStatusDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application.Dtos; 2 | 3 | public class OrderMarkCreatedStatusDto 4 | { 5 | public bool IsSuccess { get; set; } 6 | 7 | public string Remark { get; set; } = string.Empty; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Dtos/OrderReceiverDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application.Dtos; 2 | 3 | public class OrderReceiverDto : IDto 4 | { 5 | public string Name { get; set; } = string.Empty; 6 | public string Phone { get; set; } = string.Empty; 7 | public string Address { get; set; } = string.Empty; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Dtos/OrderSearchDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application.Dtos; 2 | 3 | public class OrderSearchPagedDto : SearchPagedDto 4 | { 5 | public long? Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/Dtos/OrderUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application.Dtos; 2 | 3 | public class OrderUpdationDto : IDto 4 | { 5 | /// 6 | /// 收货信息 7 | /// 8 | public OrderReceiverDto DeliveryInfomaton { get; set; } = default!; 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Application/MapperProfile.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Application; 2 | 3 | public class OrdProfile : Profile 4 | { 5 | public OrdProfile() 6 | { 7 | CreateMap(typeof(PagedModel<>), typeof(PageModelDto<>)).ForMember("XData", opt => opt.Ignore()); 8 | 9 | CreateMap(); 10 | CreateMap(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/Aggregates/OrderAggregate/OrderItemProduct.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Domain.Aggregates.OrderAggregate; 2 | 3 | public record OrderItemProduct : ValueObject 4 | { 5 | private OrderItemProduct() 6 | { 7 | Name = string.Empty; 8 | } 9 | 10 | public OrderItemProduct(long id, string name, decimal price) 11 | { 12 | Id = Checker.Variable.GTZero(id, nameof(id)); 13 | Name = Checker.Variable.NotNullOrWhiteSpace(name, nameof(name)); 14 | Price = Checker.Variable.GTZero(price, nameof(price)); 15 | } 16 | 17 | public long Id { get; } 18 | 19 | public string Name { get; } 20 | 21 | public decimal Price { get; } 22 | } 23 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/Aggregates/OrderAggregate/OrderReceiver.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Domain.Aggregates.OrderAggregate; 2 | 3 | public record OrderReceiver : ValueObject 4 | { 5 | public OrderReceiver(string name, string phone, string address) 6 | { 7 | Name = Checker.Variable.NotNullOrWhiteSpace(name, nameof(name)); 8 | Phone = Checker.Variable.NotNullOrWhiteSpace(phone, nameof(phone)); 9 | Address = Checker.Variable.NotNullOrWhiteSpace(address, nameof(address)); 10 | } 11 | 12 | /// 13 | /// 姓名 14 | /// 15 | public string Name { get; } 16 | 17 | /// 18 | /// 电话 19 | /// 20 | public string Phone { get; } 21 | 22 | /// 23 | /// 地址 24 | /// 25 | public string Address { get; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/Aggregates/OrderAggregate/OrderStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Domain.Aggregates.OrderAggregate; 2 | 3 | public record OrderStatus : ValueObject 4 | { 5 | private OrderStatus() 6 | { 7 | } 8 | 9 | public OrderStatus(OrderStatusCodes statusCode, string? reason = null) 10 | { 11 | Code = statusCode; 12 | ChangesReason = reason is null ? string.Empty : reason.Trim(); 13 | } 14 | 15 | public OrderStatusCodes Code { get; } 16 | 17 | public string? ChangesReason { get; } 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/Aggregates/OrderAggregate/OrderStatusCodes.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Domain.Aggregates.OrderAggregate; 2 | 3 | /// 4 | /// 订单状态枚举 5 | /// 6 | public enum OrderStatusCodes 7 | { 8 | Creating = 1000 9 | , 10 | WaitPay = 1008 11 | , 12 | Paying = 1016 13 | , 14 | WaitSend = 1040 15 | , 16 | WaitConfirm = 1048 17 | , 18 | WaitRate = 1056 19 | , 20 | Finished = 1064 21 | , 22 | Canceling = 1023 23 | , 24 | Cancelled = 1024 25 | , 26 | Deleted = 1032 27 | } 28 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/EntityConfig/EntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Ord.Domain.EntityConfig; 2 | 3 | public class EntityInfo : AbstractDomainEntityInfo 4 | { 5 | protected override List GetEntityAssemblies() => [GetType().Assembly, typeof(EventTracker).Assembly]; 6 | 7 | protected override void SetTableName(ModelBuilder modelBuilder) 8 | { 9 | modelBuilder.Entity().ToTable("ord_eventtracker"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Domain/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Reflection; 2 | global using Adnc.Demo.Const.Entity.Ord; 3 | global using Adnc.Demo.Ord.Domain.Aggregates.OrderAggregate; 4 | global using Adnc.Infra.Core.Guard; 5 | global using Adnc.Infra.IdGenerater.Yitter; 6 | global using Adnc.Infra.Repository.EfCore; 7 | global using Adnc.Shared.Domain; 8 | global using Adnc.Shared.Domain.Entities; 9 | global using Adnc.Shared.Repository.EfCoreEntities; 10 | global using Microsoft.EntityFrameworkCore; 11 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 12 | -------------------------------------------------------------------------------- /src/Demo/Ord/Ord.Migrations/Adnc.Demo.Ord.Migrations.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Ord.Api\bin\$(Configuration) 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Adnc.Demo.Const.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该层用来定义Const常量,不需要发布的到Nuget。 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Caching/CachingConsts.Cust.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Caching.Cust; 2 | 3 | public class CachingConsts 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Caching/CachingConsts.Maint.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Caching.Maint; 2 | 3 | public class CachingConsts 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Entity/EntityConsts.Cust.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Entity.Cust; 2 | 3 | /// 4 | /// 客户 5 | /// 6 | public static class CustomerConsts 7 | { 8 | public const int Account_MaxLength = 16; 9 | public const int Password_Maxlength = 32; 10 | public const int Nickname_MaxLength = 16; 11 | public const int Realname_Maxlength = 16; 12 | } 13 | 14 | /// 15 | /// 客户财务表 16 | /// 17 | public static class CustomerFinanceConsts 18 | { 19 | public const int Account_MaxLength = 16; 20 | } 21 | 22 | /// 23 | /// 客户财务变动 24 | /// 25 | public static class CustomerTransactionLogConsts 26 | { 27 | public const int Account_MaxLength = 16; 28 | public const int Remark_MaxLength = 64; 29 | } 30 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Entity/EntityConsts.Maint.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Entity.Maint; 2 | 3 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Entity/EntityConsts.Ord.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Entity.Ord; 2 | 3 | public static class OrdConsts 4 | { 5 | public const int Remark_MaxLength = 64; 6 | public const int ChangesReason_MaxLength = 32; 7 | public const int Name_MaxLength = 16; 8 | public const int Phone_MaxLength = 11; 9 | public const int Address_MaxLength = 64; 10 | } 11 | 12 | public static class OrderItemConsts 13 | { 14 | public const int Name_MaxLength = 64; 15 | } 16 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Entity/EntityConsts.Whse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Entity.Whse; 2 | 3 | public static class WhseConsts 4 | { 5 | public const int Code_MaxLength = 32; 6 | public const int Description_MaxLength = 64; 7 | } 8 | 9 | public static class ProductConts 10 | { 11 | public const int Name_MaxLength = 64; 12 | public const int Describe_MaxLength = 128; 13 | public const int Sku_MaxLength = 32; 14 | public const int ChangesReason_MaxLength = 32; 15 | public const int Unit_MaxLength = 4; 16 | } 17 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Mq/MqConsts.Exchanges.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Mq; 2 | 3 | public static class MqExchanges 4 | { 5 | public const string Logs = "ex-adnc-logs"; 6 | public const string Sms = "ex-adnc-sms"; 7 | public const string Emails = "ex-adnc-emails"; 8 | public const string Dead = "ex-adnc-dead-letter"; 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Mq/MqConsts.RoutingKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Mq; 2 | 3 | public static class MqRoutingKeys 4 | { 5 | public const string OpsLog = "opslog"; 6 | public const string Loginlog = "loginlog"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Permission/Permissions.Cust.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Permissions.Cust; 2 | 3 | public static class PermissionConsts 4 | { 5 | public static class Customer 6 | { 7 | public const string Create = "customer-create"; 8 | public const string Search = "customer-search"; 9 | public const string SearchTransactionLog = "customer-search-transactionlog"; 10 | public const string Recharge = "customer-recharge"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/Permission/Permissions.Maint.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const.Permissions.Maint; 2 | 3 | public static class PermissionConsts 4 | { 5 | public static class Log 6 | { 7 | public const string SearchForOperationLog = "operationlog-search"; 8 | public const string SearchForLogingLog = "loginlog-search"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/RouteConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const; 2 | 3 | public static class RouteConsts 4 | { 5 | public const string AuthRoot = "api/auth"; 6 | public const string AdminRoot = "api/admin"; 7 | public const string MaintRoot = "api/maint"; 8 | public const string CustRoot = "api/cust"; 9 | public const string OrdRoot = "api/ord"; 10 | public const string WhseRoot = "api/whse"; 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Shared/Const/ServiceAddressConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Const; 2 | 3 | public static class ServiceAddressConsts 4 | { 5 | public const string AdminDemoService = "adnc-demo-admin-api"; 6 | public const string MaintDemoService = "adnc-demo-maint-api"; 7 | public const string CustDemoService = "adnc-demo-cust-api"; 8 | public const string OrdDemoService = "adnc-demo-ord-api"; 9 | public const string WhseDemoService = "adnc-demo-whse-api"; 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Event/CustomerRechargedEvent.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Event; 2 | 3 | namespace Adnc.Demo.Remote.Event; 4 | 5 | /// 6 | /// 客户充值事件 7 | /// 8 | [Serializable] 9 | public class CustomerRechargedEvent : EventEntity 10 | { 11 | public CustomerRechargedEvent() 12 | { 13 | } 14 | 15 | public CustomerRechargedEvent(long id, string source, long custmerId, decimal amout, long transactionLogId) 16 | : base(id, source) 17 | { 18 | CustomerId = custmerId; 19 | Amount = amout; 20 | TransactionLogId = transactionLogId; 21 | } 22 | 23 | public long CustomerId { get; init; } 24 | public decimal Amount { get; init; } 25 | public long TransactionLogId { get; init; } 26 | } 27 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Event/OrderCanceledEvent.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Event; 2 | 3 | namespace Adnc.Demo.Remote.Event; 4 | 5 | /// 6 | /// 订单取消事件 7 | /// 8 | [Serializable] 9 | public sealed class OrderCanceledEvent : EventEntity 10 | { 11 | public OrderCanceledEvent() 12 | { 13 | } 14 | 15 | public OrderCanceledEvent(long id, string eventSource, long orderId) 16 | : base(id, eventSource) 17 | { 18 | OrderId = orderId; 19 | } 20 | 21 | public long OrderId { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Event/OrderCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Event; 2 | 3 | namespace Adnc.Demo.Remote.Event; 4 | 5 | /// 6 | /// 订单创建事件 7 | /// 8 | [Serializable] 9 | public class OrderCreatedEvent : EventEntity 10 | { 11 | public OrderCreatedEvent() 12 | { 13 | } 14 | 15 | public OrderCreatedEvent(long id, string eventSource, long orderId, IEnumerable orderItems) 16 | : base(id, eventSource) 17 | { 18 | OrderId = orderId; 19 | Products = orderItems; 20 | } 21 | 22 | public long OrderId { get; set; } 23 | public IEnumerable Products { get; set; } = []; 24 | 25 | public class OrderItem 26 | { 27 | public long ProductId { get; set; } 28 | public int Qty { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Event/OrderPaidEvent.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Event; 2 | 3 | namespace Adnc.Demo.Remote.Event; 4 | 5 | /// 6 | /// 订单支付事件 7 | /// 8 | [Serializable] 9 | public sealed class OrderPaidEvent : EventEntity 10 | { 11 | public OrderPaidEvent() 12 | { 13 | } 14 | 15 | public OrderPaidEvent(long id, string eventSource, long orderId, long custmerId, decimal amout) 16 | : base(id, eventSource) 17 | { 18 | OrderId = orderId; 19 | CustomerId = custmerId; 20 | Amount = amout; 21 | } 22 | 23 | public long OrderId { get; init; } 24 | 25 | public long CustomerId { get; init; } 26 | 27 | public decimal Amount { get; init; } 28 | } 29 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Event/WarehouseQtyBlockedEvent.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Event; 2 | 3 | namespace Adnc.Demo.Remote.Event; 4 | 5 | /// 6 | /// 锁定库存事件 7 | /// 8 | [Serializable] 9 | public class WarehouseQtyBlockedEvent : EventEntity 10 | { 11 | public WarehouseQtyBlockedEvent() 12 | { 13 | } 14 | 15 | public WarehouseQtyBlockedEvent(long id, string eventSource, long orderId, bool isSuccess, string remark) 16 | : base(id, eventSource) 17 | { 18 | OrderId = orderId; 19 | IsSuccess = isSuccess; 20 | Remark = remark; 21 | } 22 | 23 | public long OrderId { get; set; } 24 | 25 | public bool IsSuccess { get; set; } 26 | 27 | public string Remark { get; set; } = string.Empty; 28 | } 29 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Grpc/CustomTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Grpc.Messages; 2 | 3 | public partial class DecimalValue 4 | { 5 | private const decimal NanoFactor = 1_000_000_000; 6 | 7 | public DecimalValue(long units, int nanos) 8 | { 9 | Units = units; 10 | Nanos = nanos; 11 | } 12 | 13 | public static implicit operator decimal(DecimalValue grpcDecimal) => grpcDecimal.Units + grpcDecimal.Nanos / NanoFactor; 14 | 15 | public static implicit operator DecimalValue(decimal value) 16 | { 17 | var units = decimal.ToInt64(value); 18 | var nanos = decimal.ToInt32((value - units) * NanoFactor); 19 | return new DecimalValue(units, nanos); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Grpc/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Google.Protobuf.WellKnownTypes; 2 | global using Grpc.Core; 3 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Grpc/GrpcClientConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Grpc; 2 | 3 | public static class GrpcClientConsts 4 | { 5 | public static Empty Empty => new(); 6 | 7 | public static Metadata BearerHeader => new() 8 | { 9 | { "Authorization", "Bearer" } 10 | }; 11 | 12 | public static Metadata BasicHeader => new() 13 | { 14 | { "Authorization", "Basic" } 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Demo.Remote.Http.Messages; 2 | global using Refit; 3 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Messages/DictOptionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Http.Messages; 2 | 3 | public class DictOptionResponse 4 | { 5 | public string Name { get; set; } = string.Empty; 6 | 7 | public string Code { get; set; } = string.Empty; 8 | 9 | public DictDataOption[] DictDataList { get; set; } = []; 10 | 11 | public class DictDataOption 12 | { 13 | public string Label { get; set; } = string.Empty; 14 | public string Value { get; set; } = string.Empty; 15 | public string TagType { get; set; } = string.Empty; 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Messages/ProductResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Http.Messages; 2 | 3 | public class ProductResponse() 4 | { 5 | public long Id { get; set; } 6 | 7 | public string Name { get; set; } = string.Empty; 8 | 9 | public decimal Price { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Messages/ProductSearchRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Http.Messages; 2 | 3 | public class ProductSearchRequest 4 | { 5 | [Query(CollectionFormat.Multi)] 6 | public long[] Ids { get; set; } = []; 7 | 8 | public int StatusCode { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Messages/SysConfigSimpleResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Remote.Http.Messages; 2 | 3 | public class SysConfigSimpleResponse 4 | { 5 | /// 6 | /// 参数键 7 | /// 8 | public string Key { get; set; } = string.Empty; 9 | 10 | /// 11 | /// 参数名 12 | /// 13 | public string Name { get; set; } = string.Empty; 14 | 15 | /// 16 | /// 参数值 17 | /// 18 | public string Value { get; set; } = string.Empty; 19 | } 20 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Services/IOrderRestClient.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Http; 2 | 3 | namespace Adnc.Demo.Remote.Http.Services; 4 | 5 | public interface IOrderRestClient : IRestClient 6 | { } 7 | -------------------------------------------------------------------------------- /src/Demo/Shared/Remote.Http/Services/IWhseRestClient.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Remote.Http; 2 | 3 | namespace Adnc.Demo.Remote.Http.Services; 4 | 5 | public interface IWhseRestClient : IRestClient 6 | { 7 | /// 8 | /// whse服务-获取商品列表 9 | /// 10 | /// 11 | [Headers("Authorization: Basic", "Cache: 1000")] 12 | [Get("/whse/api/products")] 13 | Task> GetProductsAsync(ProductSearchRequest input, CancellationToken cancellationToken = default); 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Shared/protos/messages/common.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | import "google/protobuf/any.proto"; 3 | 4 | option csharp_namespace = "Adnc.Demo.Remote.Grpc.Messages"; 5 | 6 | package messages; 7 | 8 | message GrpcResponse { 9 | bool IsSuccessStatusCode = 1; 10 | google.protobuf.Any Content =2; 11 | string Error = 3; 12 | } 13 | 14 | message DecimalValue { 15 | int64 units = 1; 16 | sfixed32 nanos = 2; 17 | } -------------------------------------------------------------------------------- /src/Demo/Shared/protos/messages/sys_config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option csharp_namespace = "Adnc.Demo.Remote.Grpc.Messages"; 4 | 5 | package messages; 6 | 7 | message SysConfigSimpleListReply{ 8 | repeated SysConfigSimpleReply List = 1; 9 | } 10 | 11 | message SysConfigSimpleReply{ 12 | string Key = 1; 13 | string Name= 2; 14 | string Value =3; 15 | } 16 | 17 | message SysConfigSimpleRequest{ 18 | string Keys = 1; 19 | } -------------------------------------------------------------------------------- /src/Demo/Shared/protos/messages/sys_dictoption.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option csharp_namespace = "Adnc.Demo.Remote.Grpc.Messages"; 4 | 5 | package messages; 6 | 7 | message DictOptionRequest{ 8 | string Codes = 1; 9 | } 10 | 11 | message DictOptionListReply{ 12 | repeated DictOptionReply List = 1; 13 | } 14 | 15 | message DictOptionReply { 16 | string name = 1; 17 | string code = 2; 18 | repeated DataOption dictDataList = 3; 19 | 20 | message DataOption { 21 | string label = 1; 22 | string value = 2; 23 | string tagType = 3; 24 | } 25 | } -------------------------------------------------------------------------------- /src/Demo/Shared/protos/services/admingrpc.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "messages/sys_config.proto"; 4 | import "messages/sys_dictoption.proto"; 5 | 6 | option csharp_namespace = "Adnc.Demo.Remote.Grpc.Services"; 7 | 8 | package services; 9 | 10 | service AdminGrpc { 11 | // rpc GetSysConfigList(google.protobuf.Empty) returns (messages.GrpcResponse); 12 | // rpc GetSysConfigList(google.protobuf.StringValue) returns (messages.GrpcResponse); 13 | rpc GetSysConfigList(messages.SysConfigSimpleRequest) returns (messages.SysConfigSimpleListReply); 14 | rpc GetDictOptions(messages.DictOptionRequest) returns (messages.DictOptionListReply); 15 | } -------------------------------------------------------------------------------- /src/Demo/Shared/resources/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/Demo/Shared/resources/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Demo.Whse.Application.Dtos; 2 | global using Adnc.Demo.Whse.Application.Services; 3 | global using Adnc.Shared; 4 | global using Adnc.Shared.Application.Contracts.Dtos; 5 | global using Adnc.Shared.WebApi; 6 | global using Microsoft.AspNetCore.Mvc; 7 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/MiddlewareRegistrar.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.WebApi.Registrar; 2 | 3 | namespace Adnc.Demo.Whse.Api; 4 | 5 | public sealed class MiddlewareRegistrar(WebApplication app) : AbstractWebApiMiddlewareRegistrar(app) 6 | { 7 | public override void UseAdnc() 8 | { 9 | UseWebApiDefault(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Demo.Whse.Api": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "SqlServer": { 3 | "ConnectionString": "Data Source=62.234.187.128;Initial Catalog=adnc_whse;User Id=sa;Password=Adnc_6666; " 4 | }, 5 | "Kestrel": { 6 | "Endpoints": { 7 | "Default": { 8 | "Url": "http://0.0.0.0:50050" 9 | }, 10 | "Grpc": { 11 | "Url": "http://0.0.0.0:50051", 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/shared/appsettings,adnc/production/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/shared/appsettings,adnc/staging/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/shared/appsettings,adnc/test/$SHORTNAME/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Cache/CacheService.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Infra.Redis.Caching.Core.Preheater; 2 | 3 | namespace Adnc.Demo.Whse.Application.Cache; 4 | 5 | public class CacheService(Lazy cacheProvider, Lazy serviceProvider) : AbstractCacheService(cacheProvider, serviceProvider), ICachePreheatable 6 | { 7 | public override async Task PreheatAsync() => await Task.CompletedTask; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProducChangePriceDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProducChangePriceDto : IDto 4 | { 5 | public decimal Price { set; get; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductCreationDto : IDto 4 | { 5 | public string Sku { set; get; } = string.Empty; 6 | 7 | public string Name { set; get; } = string.Empty; 8 | 9 | public string Describe { set; get; } = string.Empty; 10 | 11 | public decimal Price { set; get; } 12 | 13 | public string Unit { set; get; } = string.Empty; 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductDto : IDto 4 | { 5 | public long Id { set; get; } 6 | 7 | public string Unit { set; get; } = string.Empty; 8 | 9 | public string Sku { set; get; } = string.Empty; 10 | 11 | public string Name { set; get; } = string.Empty; 12 | 13 | public string Describe { set; get; } = string.Empty; 14 | 15 | public decimal Price { set; get; } 16 | 17 | public int StatusCode { get; set; } 18 | 19 | public string StatusDescription { get; set; } = string.Empty; 20 | 21 | public string StatusChangesReason { get; set; } = string.Empty; 22 | } 23 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductPutOffSaleDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductPutOffSaleDto : ProductPutOnSaleDto 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductPutOnSaleDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductPutOnSaleDto : IDto 4 | { 5 | public string Reason { get; set; } = string.Empty; 6 | } 7 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductSearchListDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductSearchListDto : SearchDto 4 | { 5 | public long[] Ids { get; set; } = []; 6 | 7 | public int StatusCode { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductSearchPagedDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductSearchPagedDto : SearchPagedDto 4 | { 5 | public long Id { get; set; } 6 | 7 | public int StatusCode { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/ProductUpdationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class ProductUpdationDto : IDto 4 | { 5 | public string Sku { set; get; } = string.Empty; 6 | 7 | public string Name { set; get; } = string.Empty; 8 | 9 | public string Describe { set; get; } = string.Empty; 10 | 11 | public string Unit { set; get; } = string.Empty; 12 | 13 | public decimal Price { set; get; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/WarehouseAllocateToProductDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class WarehouseAllocateToProductDto : IDto 4 | { 5 | public long ProductId { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/WarehouseBlockQtyDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class WarehouseBlockQtyDto : IDto 4 | { 5 | public long OrderId { get; set; } 6 | 7 | public IEnumerable<(long ProductId, int Qty)> Products { get; set; } = []; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/WarehouseCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class WarehouseCreationDto : IDto 4 | { 5 | public string PositionCode { get; set; } = string.Empty; 6 | 7 | public string PositionDescription { get; set; } = string.Empty; 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/WarehouseDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class WarehouseDto : IDto 4 | { 5 | public long Id { get; set; } 6 | 7 | public long? ProductId { set; get; } 8 | 9 | public int Qty { set; get; } 10 | 11 | public int FreezedQty { set; get; } 12 | 13 | public string PositionCode { get; set; } = string.Empty; 14 | 15 | public string PositionDescription { get; set; } = string.Empty; 16 | 17 | public string ProductSku { get; set; } = string.Empty; 18 | 19 | public string ProductName { get; set; } = string.Empty; 20 | } 21 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/Dtos/WarehouseSearchDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application.Dtos; 2 | 3 | public class WarehouseSearchDto : SearchPagedDto 4 | { } 5 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Application/MapperProfile.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Application; 2 | 3 | public class WhseProfile : Profile 4 | { 5 | public WhseProfile() 6 | { 7 | CreateMap(typeof(PagedModel<>), typeof(PageModelDto<>)).ForMember("XData", opt => opt.Ignore()); 8 | CreateMap(); 9 | CreateMap(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/Aggregates/ProductAggregate/ProductStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Domain.Aggregates.ProductAggregate; 2 | 3 | public record ProductStatus : ValueObject 4 | { 5 | private ProductStatus() 6 | { 7 | } 8 | 9 | internal ProductStatus(ProductStatusCodes statusCode, string reason) 10 | { 11 | Code = statusCode; 12 | ChangesReason = reason is null ? string.Empty : reason.Trim(); 13 | } 14 | 15 | public ProductStatusCodes Code { get; } 16 | 17 | public string ChangesReason { get; } = string.Empty; 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/Aggregates/ProductStatusCodes.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Domain.Aggregates; 2 | 3 | public enum ProductStatusCodes 4 | { 5 | UnKnow = 1000 6 | , 7 | SaleOff = 1008 8 | , 9 | SaleOn = 1016 10 | } 11 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/Aggregates/WarehouseAggregate/InventoryChangeLogs.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Domain.Aggregates.WarehouseAggregate; 2 | 3 | public class InventoryChangesLog : DomainEntity 4 | { } 5 | 6 | public enum InventoryChangesEnum 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/Aggregates/WarehouseAggregate/WarehousePosition.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Domain.Aggregates.WarehouseAggregate; 2 | 3 | public record WarehousePosition : ValueObject 4 | { 5 | private WarehousePosition() 6 | { 7 | } 8 | 9 | internal WarehousePosition(string code, string description) 10 | { 11 | Code = Checker.Variable.NotNullOrWhiteSpace(code, nameof(code)); 12 | Description = description is null ? string.Empty : description.Trim(); 13 | } 14 | 15 | public string Code { get; } = string.Empty; 16 | 17 | public string Description { get; } = string.Empty; 18 | } 19 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/EntityConfig/EntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Demo.Whse.Domain.EntityConfig; 2 | 3 | public class EntityInfo : AbstractDomainEntityInfo 4 | { 5 | protected override List GetEntityAssemblies() => [GetType().Assembly, typeof(EventTracker).Assembly]; 6 | 7 | protected override void SetTableName(ModelBuilder modelBuilder) 8 | { 9 | modelBuilder.Entity().ToTable("whse_eventtracker"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Domain/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Reflection; 2 | global using Adnc.Demo.Const.Entity.Whse; 3 | global using Adnc.Infra.Core.Exceptions; 4 | global using Adnc.Infra.Core.Guard; 5 | global using Adnc.Infra.IdGenerater.Yitter; 6 | global using Adnc.Infra.Repository; 7 | global using Adnc.Infra.Repository.EfCore; 8 | global using Adnc.Shared.Domain; 9 | global using Adnc.Shared.Domain.Entities; 10 | global using Adnc.Shared.Repository.EfCoreEntities; 11 | global using Microsoft.EntityFrameworkCore; 12 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 13 | -------------------------------------------------------------------------------- /src/Demo/Whse/Whse.Migrations/Adnc.Demo.Whse.Migrations.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | ..\Whse.Api\bin\$(Configuration) 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Gateways/Ocelot/IpAddressConsulServiceBuilder.cs: -------------------------------------------------------------------------------- 1 | using Consul; 2 | using Ocelot.Logging; 3 | using Ocelot.Provider.Consul; 4 | using Ocelot.Provider.Consul.Interfaces; 5 | 6 | namespace Adnc.Gateway.Ocelot; 7 | 8 | public class IpAddressConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory) 9 | : DefaultConsulServiceBuilder(contextAccessor, clientFactory, loggerFactory) 10 | { 11 | // I want to use the agent service IP address as the downstream hostname 12 | protected override string GetDownstreamHost(ServiceEntry entry, Node node) 13 | => entry.Service.Address; 14 | } 15 | -------------------------------------------------------------------------------- /src/Gateways/Ocelot/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Adnc.Gateway.Ocelot": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore" 9 | }, 10 | "applicationUrl": "http://localhost:5000" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Gateways/Ocelot/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/production/gateway/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Gateways/Ocelot/appsettings.Staging.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/staging/gateway/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Gateways/Ocelot/appsettings.Test.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConfigurationType": "Consul", 3 | "Consul": { 4 | "ConsulUrl": "http://10.2.8.5:8500", 5 | "ConsulKeyPath": "adnc/test/gateway/appsettings" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Gateways/Ocelot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/Gateways/Ocelot/wwwroot/adnc-topics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/Gateways/Ocelot/wwwroot/adnc-topics.png -------------------------------------------------------------------------------- /src/Gateways/Ocelot/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/Gateways/Ocelot/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Configuration/ConsulOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Configuration; 2 | 3 | public class ConsulOptions 4 | { 5 | public string ConsulUrl { get; set; } = string.Empty; 6 | public string ServiceName { get; set; } = string.Empty; 7 | public string HealthCheckUrl { get; set; } = string.Empty; 8 | public int HealthCheckIntervalInSecond { get; set; } 9 | public string[] ServerTags { get; set; } = []; 10 | public string ConsulKeyPath { get; set; } = string.Empty; 11 | public int DeregisterCriticalServiceAfter { get; set; } 12 | public int Timeout { get; set; } 13 | public string Token { get; set; } = string.Empty; 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Configuration/DefaultConsulConfigurationSource.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Configuration; 2 | 3 | public class DefaultConsulConfigurationSource(ConsulClient configClient, string consulKeyPath, bool reloadOnChanges) : IConfigurationSource 4 | { 5 | public IConfigurationProvider Build(IConfigurationBuilder builder) 6 | { 7 | return new DefaultConsulConfigurationProvider(configClient, consulKeyPath, reloadOnChanges); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Discover/Balancers/ILoadBalancer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Discover.Balancers; 2 | 3 | public interface ILoadBalancer 4 | { 5 | string Resolve(IList services); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Discover/Balancers/RandomLoadBalancer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Discover.Balancers; 2 | 3 | internal sealed class RandomLoadBalancer : ILoadBalancer 4 | { 5 | private readonly Random _random = new(); 6 | 7 | public string Resolve(IList services) 8 | { 9 | var index = _random.Next(services.Count); 10 | return services[index]; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Discover/Balancers/RoundRobinLoadBalancer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Discover.Balancers; 2 | 3 | internal sealed class RoundRobinLoadBalancer : ILoadBalancer 4 | { 5 | private readonly object _lock = new(); 6 | private int _index; 7 | 8 | public string Resolve(IList services) 9 | { 10 | lock (_lock) 11 | { 12 | if (_index >= services.Count) 13 | { 14 | _index = 0; 15 | } 16 | return services[_index++]; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Discover/Balancers/TypeLoadBalancer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Discover.Balancers; 2 | 3 | public static class TypeLoadBalancer 4 | { 5 | public static ILoadBalancer RandomLoad => new RandomLoadBalancer(); 6 | public static ILoadBalancer RoundRobinLoad => new RoundRobinLoadBalancer(); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/Discover/IDiscoverProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Consul.Discover; 2 | 3 | public interface IDiscoverProvider 4 | { 5 | Task> GetAllHealthServicesAsync(); 6 | 7 | Task GetSingleHealthServiceAsync(); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Consul/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Net; 2 | global using Consul; 3 | global using Microsoft.Extensions.Configuration; 4 | global using Microsoft.Extensions.DependencyInjection; 5 | global using Microsoft.Extensions.Hosting; 6 | global using Microsoft.Extensions.Logging; 7 | global using Microsoft.Extensions.Options; 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Exceptions/BusinessException.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Core.Exceptions; 2 | 3 | [Serializable] 4 | public class BusinessException(string message) : Exception(message), IAdncException 5 | { 6 | public int Status { get; set; } = 521; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Exceptions/IAdncException.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Core.Exceptions; 2 | 3 | public interface IAdncException 4 | { 5 | int Status { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Exceptions/InvalidVariableException.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Core.Exceptions; 2 | 3 | [Serializable] 4 | public class InvalidVariableException(string message) : Exception(message), IAdncException 5 | { 6 | public int Status { get; set; } = 520; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Extensions/Enum/EnumExtension.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace System; 4 | 5 | public static class EnumExtension 6 | { 7 | /// 8 | /// An object extension method that gets description attribute. 9 | /// 10 | /// The value to act on. 11 | /// The description attribute. 12 | public static string? GetDescription(this Enum value) 13 | { 14 | var attr = value?.GetType() 15 | ?.GetField(value.ToString()) 16 | ?.GetCustomAttribute(); 17 | return attr?.Description; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Extensions/Stream/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace System; 2 | 3 | public static class StreamExtensions 4 | { 5 | /// 6 | /// Stream write all bytes 7 | /// 8 | /// 9 | /// 10 | public static void WriteAll(this Stream stream, byte[] byts) 11 | { 12 | stream.Write(byts, 0, byts.Length); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Extensions/Type/AssemblyExtension.cs: -------------------------------------------------------------------------------- 1 | namespace System; 2 | 3 | public static class AssemblyExtension 4 | { 5 | public static IEnumerable GetImplementationTypesWithOutAbstractClass(this Assembly assembly) 6 | where TServiceType : class 7 | { 8 | var implTypes = GetImplementationTypes(assembly).Where(type => type.IsNotAbstractClass(true)); 9 | return implTypes ?? []; 10 | } 11 | 12 | public static IEnumerable GetImplementationTypes(this Assembly assembly) 13 | where TServiceType : class 14 | { 15 | var serviceType = typeof(TServiceType); 16 | var implTypes = assembly.ExportedTypes.Where(type => type.IsAssignableTo(serviceType)); 17 | return implTypes ?? []; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Collections.Concurrent; 2 | global using System.Diagnostics.CodeAnalysis; 3 | global using System.Net; 4 | global using System.Reflection; 5 | global using Microsoft.Extensions.Configuration; 6 | global using Microsoft.Extensions.Hosting; 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Guard/Checker.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Core.Guard; 2 | 3 | public static class Checker 4 | { 5 | static Checker() 6 | { 7 | } 8 | 9 | public static ArgumentChecker Argument => ArgumentChecker.Instance; 10 | 11 | public static VariableChecker Variable => VariableChecker.Instance; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Json/BoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace System.Text.Json; 4 | 5 | public class BoolConverter : JsonConverter 6 | { 7 | public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 8 | { 9 | var obj = reader.GetInt32(); 10 | return obj != 0; 11 | } 12 | 13 | public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) 14 | { 15 | writer.WriteNumberValue(value ? 1 : 0); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Json/DateTimeConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace System.Text.Json; 4 | 5 | public class DateTimeConverter : JsonConverter 6 | { 7 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 8 | { 9 | var dateString = reader.GetString() ?? throw new ArgumentException(nameof(Utf8JsonReader)); 10 | return DateTime.Parse(dateString); 11 | } 12 | 13 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 14 | { 15 | writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructures/Core/Json/DateTimeNullableConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace System.Text.Json; 4 | 5 | public class DateTimeNullableConverter : JsonConverter 6 | { 7 | public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 8 | { 9 | var result = default(DateTime?); 10 | if (DateTime.TryParse(reader.GetString(), out var datetime)) 11 | { 12 | result = datetime; 13 | } 14 | 15 | return result; 16 | } 17 | 18 | public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options) 19 | { 20 | writer.WriteStringValue(value?.ToString("yyyy-MM-dd HH:mm:ss")); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Infrastructures/EventBus/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.Extensions.Configuration; 2 | global using Microsoft.Extensions.Hosting; 3 | global using Microsoft.Extensions.Logging; 4 | global using Microsoft.Extensions.Options; 5 | global using Polly; 6 | -------------------------------------------------------------------------------- /src/Infrastructures/EventBus/RabbitMq/ExchageConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.EventBus.RabbitMq; 2 | 3 | public class ExchageConfig 4 | { 5 | public string Name { get; set; } = string.Empty; 6 | public ExchangeType Type { get; set; } = default!; 7 | public string DeadExchangeName { get; set; } = string.Empty; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/EventBus/RabbitMq/ExchangeType.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.EventBus.RabbitMq; 2 | 3 | public enum ExchangeType 4 | { 5 | //发布订阅模式 6 | Fanout, 7 | 8 | //路由模式 9 | Direct, 10 | 11 | //通配符模式 12 | Topic 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Adnc.Infra.Helper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该库提供一些通用帮助类,如HashHelper,SecurityHelper等等。 4 | adnc,helper 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Linq.Expressions; 2 | global using System.Reflection; 3 | global using System.Security.Cryptography; 4 | global using System.Text; 5 | global using System.Text.Json; 6 | global using System.Text.RegularExpressions; 7 | global using System.Xml; 8 | global using Microsoft.AspNetCore.Http; 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/InfraHelper.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Infra.Helper.Internal; 2 | using Adnc.Infra.Helper.Internal.Encrypt; 3 | 4 | namespace Adnc.Infra.Helper; 5 | 6 | public static class InfraHelper 7 | { 8 | private static readonly EncryptProivder _encypt = new(); 9 | private static readonly HashConsistentGenerater _hashConsistentGenerater = new(); 10 | private static readonly Internal.HttpContextAccessor _accessor = new(); 11 | 12 | static InfraHelper() 13 | { 14 | } 15 | 16 | public static EncryptProivder Encrypt => _encypt; 17 | 18 | public static HashConsistentGenerater HashConsistent => _hashConsistentGenerater; 19 | 20 | public static Internal.HttpContextAccessor HttpContextAccessor => _accessor; 21 | } 22 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/EncryptProivder.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt; 2 | 3 | public sealed partial class EncryptProivder 4 | { 5 | internal EncryptProivder() 6 | { 7 | } 8 | 9 | private Random RandomInstance { get; } = new Random(); 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/AESKey.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | public class AESKey 4 | { 5 | /// 6 | /// ase key 7 | /// 8 | public string Key { get; set; } = string.Empty; 9 | 10 | /// 11 | /// ase IV 12 | /// 13 | public string IV { get; set; } = string.Empty; 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/MD5Length.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | public enum MD5Length 4 | { 5 | L16 = 16, 6 | L32 = 32 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/RSAKey.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | public class RSAKey 4 | { 5 | /// 6 | /// Rsa public key 7 | /// 8 | public string PublicKey { get; set; } = string.Empty; 9 | 10 | /// 11 | /// Rsa private key 12 | /// 13 | public string PrivateKey { get; set; } = string.Empty; 14 | 15 | /// 16 | /// Rsa public key Exponent 17 | /// 18 | public string Exponent { get; set; } = string.Empty; 19 | 20 | /// 21 | /// Rsa public key Modulus 22 | /// 23 | public string Modulus { get; set; } = string.Empty; 24 | } 25 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/RSAParametersJson.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | internal sealed class RSAParametersJson 4 | { 5 | //Public key Modulus 6 | public string? Modulus { get; set; } = string.Empty; 7 | 8 | //Public key Exponent 9 | public string? Exponent { get; set; } = string.Empty; 10 | 11 | public string? P { get; set; } = string.Empty; 12 | 13 | public string? Q { get; set; } = string.Empty; 14 | 15 | public string? DP { get; set; } = string.Empty; 16 | 17 | public string? DQ { get; set; } = string.Empty; 18 | 19 | public string? InverseQ { get; set; } = string.Empty; 20 | 21 | public string? D { get; set; } = string.Empty; 22 | } 23 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/RsaKeyType.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | public enum RsaKeyType 4 | { 5 | XML, 6 | JSON 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Helper/Internal/Encrypt/Shared/RsaSize.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Helper.Internal.Encrypt.Shared; 2 | 3 | public enum RsaSize 4 | { 5 | R2048 = 2048, 6 | R3072 = 3072, 7 | R4096 = 4096 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/IdGenerater/Adnc.Infra.IdGenerater.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该库负责Id的生成,目前实现了雪花算法生成器,可以动态获取WorkerId。 4 | adnc,snowklake,yitter 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Infrastructures/IdGenerater/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Redis; 2 | global using Microsoft.Extensions.Configuration; 3 | global using Microsoft.Extensions.Hosting; 4 | global using Microsoft.Extensions.Logging; 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/BloomFilter/BloomFilterFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.BloomFilter; 2 | 3 | public sealed class BloomFilterFactory(IEnumerable instances, IOptions redisOptions) 4 | { 5 | public IBloomFilter Create(string name) 6 | { 7 | IBloomFilter? bloomFilter; 8 | if (redisOptions.Value.EnableBloomFilter) 9 | { 10 | bloomFilter = instances.First(x => x.Name.EqualsIgnoreCase(name)); 11 | } 12 | else 13 | { 14 | bloomFilter = instances.First(x => x.Name.EqualsIgnoreCase("null")); 15 | } 16 | 17 | return bloomFilter; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/BloomFilter/BloomFilterHostedService.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.BloomFilter; 2 | 3 | public class BloomFilterHostedService(IEnumerable bloomFilters, IOptions redisOptions) : BackgroundService 4 | { 5 | protected override async Task ExecuteAsync(CancellationToken stoppingToken) 6 | { 7 | if (redisOptions.Value.EnableBloomFilter && bloomFilters.IsNotNullOrEmpty()) 8 | { 9 | foreach (var filter in bloomFilters) 10 | { 11 | await filter.InitAsync(); 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforeExistsRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforeExistsRequestEventData(string cacheType, string name, string operation, string cacheKey) : EventData(cacheType, name, operation) 4 | { 5 | public string CacheKey { get; set; } = cacheKey; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforeGetRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforeGetRequestEventData(string cacheType, string name, string operation, string[] cacheKeys, TimeSpan? expiration = null) : EventData(cacheType, name, operation) 4 | { 5 | public string[] CacheKeys { get; set; } = cacheKeys; 6 | 7 | public TimeSpan? Expiration { get; set; } = expiration; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforePublishMessageRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforePublishMessageRequestEventData //: EventData 4 | { 5 | //public BeforePublishMessageRequestEventData(string topic, Bus.Adnc.Infra.RedisMessage msg) 6 | //{ 7 | // this.Topic = topic; 8 | // this.Msg = msg; 9 | //} 10 | 11 | //public string Topic { get; set; } 12 | 13 | //public Bus.Adnc.Infra.RedisMessage Msg { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforeRemoveRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforeRemoveRequestEventData(string cacheType, string name, string operation, string[] cacheKeys) : EventData(cacheType, name, operation) 4 | { 5 | public string[] CacheKeys { get; set; } = cacheKeys; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforeSetRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforeSetRequestEventData(string cacheType, string name, string operation, IDictionary dict, TimeSpan expiration) : EventData(cacheType, name, operation) 4 | { 5 | public IDictionary Dict { get; set; } = dict; 6 | 7 | public TimeSpan Expiration { get; set; } = expiration; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/BeforeSubscribeMessageRequestEventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class BeforeSubscribeMessageRequestEventData //: EventData 4 | { 5 | //public BeforeSubscribeMessageRequestEventData(Bus.Adnc.Infra.RedisMessage msg) 6 | //{ 7 | // this.Msg = msg; 8 | //} 9 | 10 | //public Bus.Adnc.Infra.RedisMessage Msg { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/DiagnosticDataWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class DiagnosticDataWrapper 4 | { 5 | public Guid OperationId { get; set; } 6 | 7 | public long Timestamp { get; set; } 8 | } 9 | 10 | public class DiagnosticExceptionWrapper : DiagnosticDataWrapper 11 | { 12 | public Exception Exception { get; set; } = default!; 13 | } 14 | 15 | public class DiagnosticDataWrapper : DiagnosticDataWrapper 16 | where T : notnull 17 | { 18 | public T EventData { get; set; } = default!; 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Diagnostics/EventData.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Diagnostics; 2 | 3 | public class EventData(string cacheType, string name, string operation) 4 | { 5 | public string CacheType { get; set; } = cacheType; 6 | 7 | public string Name { get; set; } = name; 8 | 9 | public string Operation { get; set; } = operation; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/CachingAbleAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Interceptor; 2 | 3 | /// 4 | /// Adnc.Infra.Redis able attribute. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method, Inherited = true)] 7 | public class CachingAbleAttribute : CachingInterceptorAttribute 8 | { 9 | /// 10 | /// Gets or sets the expiration. The default value is 30 second. 11 | /// 12 | /// The expiration. 13 | public int Expiration { get; set; } = 30; 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/CachingParamAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Interceptor; 2 | 3 | [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] 4 | public class CachingParamAttribute : Attribute 5 | { 6 | public CachingParamAttribute() 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/CachingPutAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Caching.Interceptor 2 | { 3 | using System; 4 | 5 | /// 6 | /// Easycaching put attribute. 7 | /// 8 | [AttributeUsage(AttributeTargets.Method, Inherited = true)] 9 | public class CachingPutAttribute : CachingInterceptorAttribute 10 | { 11 | /// 12 | /// Gets or sets the expiration. The default value is 30 second. 13 | /// 14 | /// The expiration. 15 | public int Expiration { get; set; } = 30; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/Castle/CachingInterceptor.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | 3 | namespace Adnc.Infra.Redis.Caching.Core.Interceptor.Castle; 4 | 5 | /// 6 | /// caching interceptor 7 | /// 8 | public class CachingInterceptor(CachingAsyncInterceptor cachingAsyncInterceptor) : IInterceptor 9 | { 10 | public void Intercept(IInvocation invocation) 11 | { 12 | cachingAsyncInterceptor.ToInterceptor().Intercept(invocation); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/Castle/TypeExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Interceptor.Castle; 2 | 3 | public static class TypeExtensions 4 | { 5 | private static readonly ConcurrentDictionary _isTaskOfTCache = new(); 6 | 7 | public static bool IsTaskWithResult(this TypeInfo typeInfo) 8 | { 9 | ArgumentNullException.ThrowIfNull(typeInfo); 10 | return _isTaskOfTCache.GetOrAdd(typeInfo, Info => Info.IsGenericType && typeof(Task).GetTypeInfo().IsAssignableFrom(Info)); 11 | } 12 | 13 | public static bool IsTask(this TypeInfo typeInfo) 14 | { 15 | ArgumentNullException.ThrowIfNull(typeInfo); 16 | return typeInfo.AsType() == typeof(Task); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Interceptor/ICachable.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Interceptor; 2 | 3 | /// 4 | /// Cachable. 5 | /// 6 | public interface ICachable 7 | { 8 | /// 9 | /// Gets the cache key. 10 | /// 11 | /// The cache key. 12 | string CacheKey { get; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Preheater/ICachePreheatable.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core.Preheater; 2 | 3 | public interface ICachePreheatable 4 | { 5 | /// 6 | /// 预热缓存 7 | /// 8 | /// 9 | Task PreheatAsync(); 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Stats/LocalVariables.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core; 2 | 3 | public sealed class LocalVariables 4 | { 5 | private static readonly Lazy _lazy = new(() => new LocalVariables()); 6 | private static readonly ConcurrentQueue _queue = new(); 7 | 8 | static LocalVariables() 9 | { 10 | } 11 | 12 | private LocalVariables() 13 | { 14 | } 15 | 16 | public static LocalVariables Instance => _lazy.Value; 17 | 18 | public ConcurrentQueue Queue => _queue; 19 | 20 | public sealed class Model(IEnumerable cacheKeys, DateTime expireDt) 21 | { 22 | public List CacheKeys { get; init; } = cacheKeys.ToList(); 23 | public DateTime ExpireDt { get; init; } = expireDt; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/Core/Stats/StatsType.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Caching.Core; 2 | 3 | /// 4 | /// Stats type. 5 | /// 6 | public enum StatsType 7 | { 8 | /// 9 | /// The hit. 10 | /// 11 | Hit = 0, 12 | 13 | /// 14 | /// The missed. 15 | /// 16 | Missed = 1, 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis.Caching/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Collections.Concurrent; 2 | global using System.Diagnostics; 3 | global using System.Reflection; 4 | global using Adnc.Infra.Redis.Configurations; 5 | global using Microsoft.Extensions.Configuration; 6 | global using Microsoft.Extensions.Hosting; 7 | global using Microsoft.Extensions.Logging; 8 | global using Microsoft.Extensions.Options; 9 | global using Polly; 10 | global using StackExchange.Redis; 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis/Adnc.Infra.Redis.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该库集成了`StackExchange.Redis`客户端,提供Redis常用类型操作、分布式锁、布隆过滤器。 4 | adnc,redis,stackexchange.redis 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis/Configurations/RedisOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Configurations; 2 | 3 | /// 4 | /// RedisConfig Configurations 5 | /// 6 | public class RedisOptions 7 | { 8 | public string Provider { get; set; } = "StackExchange"; 9 | public bool EnableBloomFilter { get; set; } 10 | public string SerializerName { get; set; } = string.Empty; 11 | public DBOptions Dbconfig { get; set; } = default!; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis/Core/Internal/ConstValue.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Core; 2 | 3 | /// 4 | /// Adnc.Infra.Redis const value. 5 | /// 6 | public static class ConstValue 7 | { 8 | public const int PollyTimeout = 5; 9 | 10 | public static class Serializer 11 | { 12 | public const string DefaultBinarySerializerName = "binary"; 13 | 14 | public const string DefaultProtobufSerializerName = "proto"; 15 | 16 | public const string DefaultJsonSerializerName = "json"; 17 | } 18 | 19 | public static class Provider 20 | { 21 | public const string StackExchange = "StackExchange"; 22 | public const string FreeRedis = "FreeRedis"; 23 | public const string ServiceStack = "ServiceStack"; 24 | public const string CSRedis = "CSRedis"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Collections.Concurrent; 2 | global using System.Net; 3 | global using Adnc.Infra.Core.Guard; 4 | global using Microsoft.Extensions.Configuration; 5 | global using Microsoft.Extensions.Logging; 6 | global using Microsoft.Extensions.Options; 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Redis/Providers/StackExchange/DefaultRedisProvider.Stream.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Redis.Providers.StackExchange; 2 | 3 | /// 4 | /// Default redis caching provider. 5 | /// 6 | public partial class DefaultRedisProvider : Adnc.Infra.Redis.IRedisProvider 7 | { } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.Dapper/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Data; 2 | global using Adnc.Infra.Repository; 3 | global using Dapper; 4 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.MongoDB/Adnc.Infra.Repository.EfCore.MongoDB.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该工程是在`Adnc.Infra.Repository.EfCore`基础上MongoDB的实现。 4 | adnc,efcore,mongodb 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.MongoDB/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Linq.Expressions; 2 | global using Adnc.Infra.Repository; 3 | global using Microsoft.EntityFrameworkCore; 4 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.MongoDB/MongoDbContext.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.EfCore.MongoDB; 2 | 3 | public class MongoDbContext(DbContextOptions options, IEntityInfo entityInfo, Operater operater) : AdncDbContext(options, entityInfo, operater) 4 | { } 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.MongoDB/MongoEntity.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | using MongoDB.Bson.Serialization.IdGenerators; 4 | 5 | namespace Adnc.Infra.Repository.EfCore.MongoDB; 6 | 7 | /// 8 | /// An entity in a MongoDB repository. 9 | /// 10 | public abstract class MongoEntity : IEntity 11 | { 12 | /// 13 | /// Gets or sets the identifier. 14 | /// 15 | //_id 由StringObjectIdGenerator 生成,存储类型是string 16 | //[BsonId(IdGenerator = typeof(StringObjectIdGenerator))] 17 | //告诉mongodb这个字段在数据库中的类型是ObjectId,加这个特性是为了解决nlog生成日志时,存入的是objectid类型。 18 | [BsonId(IdGenerator = typeof(StringObjectIdGenerator))] 19 | [BsonRepresentation(BsonType.ObjectId)] 20 | public string Id { get; set; } = string.Empty; 21 | } 22 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.Mysql/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Data; 2 | global using Adnc.Infra.Repository; 3 | global using Adnc.Infra.Repository.EfCore.Transaction; 4 | global using DotNetCore.CAP; 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Storage; 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.Mysql/MySQLDbContext.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.EfCore.MySql; 2 | 3 | public class MySqlDbContext(DbContextOptions options, IEntityInfo entityInfo, Operater operater) : AdncDbContext(options, entityInfo, operater) 4 | { 5 | protected override void OnModelCreating(ModelBuilder modelBuilder) 6 | { 7 | //System.Diagnostics.Debugger.Launch(); 8 | modelBuilder.HasCharSet("utf8mb4 "); 9 | base.OnModelCreating(modelBuilder); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.SqlServer/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Data; 2 | global using Adnc.Infra.Repository; 3 | global using Adnc.Infra.Repository.EfCore.Transaction; 4 | global using DotNetCore.CAP; 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Storage; 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore.SqlServer/SqlServerDbContext.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.EfCore.SqlServer; 2 | 3 | public class SqlServerDbContext(DbContextOptions options, IEntityInfo entityInfo, Operater operater) : AdncDbContext(options, entityInfo, operater) 4 | { } 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/Adnc.Infra.Repository.EfCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该库是`Adnc.Infra.Repository`相关接口EfCore的实现,提供数据库CRUD操作,支持分布式事务。 4 | adnc,repository,efcore 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/Extensions/PocoLoadingExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace Adnc.Infra.Repository.EfCore.Extensions; 4 | 5 | /// 6 | /// 延时加载扩展方法 7 | /// 8 | public static class PocoLoadingExtension 9 | { 10 | public static TRelated Load( 11 | this Action loader, 12 | object entity, 13 | ref TRelated navigationField, 14 | [CallerMemberName] string? navigationName = null) 15 | where TRelated : class 16 | { 17 | loader?.Invoke(entity, navigationName ?? string.Empty); 18 | 19 | return navigationField; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/Extensions/SetPropertyCallsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Query; 2 | 3 | namespace Adnc.Infra.Repository.EfCore.Extensions; 4 | 5 | public static class SetPropertyCallsExtensions 6 | { 7 | public static Expression, SetPropertyCalls>> Append(this Expression, SetPropertyCalls>> left, Expression, SetPropertyCalls>> right) 8 | { 9 | var replace = new ReplacingExpressionVisitor(right.Parameters, [left.Body]); 10 | var combined = replace.Visit(right.Body); 11 | return Expression.Lambda, SetPropertyCalls>>(combined, left.Parameters); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Data; 2 | global using System.Linq.Expressions; 3 | global using Adnc.Infra.Repository.EfCore.Internal; 4 | global using Microsoft.EntityFrameworkCore; 5 | global using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 7 | global using Microsoft.EntityFrameworkCore.Storage; 8 | //global using Z.EntityFramework.Plus; 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/Internal/KeyEntryModel.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.EfCore.Internal; 2 | 3 | internal sealed class KeyEntryModel 4 | { 5 | public string PropertyName { get; set; } = string.Empty; 6 | 7 | public string ColumnName { get; set; } = string.Empty; 8 | 9 | public object Value { get; set; } = default!; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository.EfCore/NullEntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.EfCore; 2 | 3 | public class NullEntityInfo : IEntityInfo 4 | { 5 | public void OnModelCreating(ModelBuilder modelBuilder) 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Adnc.Infra.Repository.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该工程定义了Entity对象的基类、UnitOfWork接口、仓储接口。 4 | adnc,repository 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/EfEnities/EfBasicAuditEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public abstract class EfBasicAuditEntity : EfEntity, IBasicAuditInfo 4 | { 5 | /// 6 | /// 创建人 7 | /// 8 | public long CreateBy { get; set; } 9 | 10 | /// 11 | /// 创建时间/注册时间 12 | /// 13 | public DateTime CreateTime { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/EfEnities/EfEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public abstract class EfEntity : Entity, IEfEntity 4 | { } 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/EfEnities/EfFullAuditEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public abstract class EfFullAuditEntity : EfEntity, IFullAuditInfo 4 | { 5 | /// 6 | /// 创建人 7 | /// 8 | public long CreateBy { get; set; } 9 | 10 | /// 11 | /// 创建时间/注册时间 12 | /// 13 | public DateTime CreateTime { get; set; } 14 | 15 | /// 16 | /// 最后更新人 17 | /// 18 | public long ModifyBy { get; set; } 19 | 20 | /// 21 | /// 最后更新时间 22 | /// 23 | public DateTime ModifyTime { get; set; } 24 | } 25 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/EfEnities/IEfEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IEfEntity : IEntity 4 | { } 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/Entity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public class Entity : IEntity 4 | { 5 | public long Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/IBasicAuditInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IBasicAuditInfo 4 | { 5 | /// 6 | /// 创建人 7 | /// 8 | public long CreateBy { get; set; } 9 | 10 | /// 11 | /// 创建时间/注册时间 12 | /// 13 | public DateTime CreateTime { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/IConcurrency.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IConcurrency 4 | { 5 | /// 6 | /// 并发控制列 7 | /// 8 | public byte[] RowVersion { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IEntity 4 | { 5 | public TKey Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/IEntityInfo.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace Adnc.Infra.Repository; 4 | 5 | public interface IEntityInfo 6 | { 7 | void OnModelCreating(ModelBuilder modelBuilder); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/IFullAuditInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IFullAuditInfo : IBasicAuditInfo 4 | { 5 | /// 6 | /// 最后更新人 7 | /// 8 | public long ModifyBy { get; set; } 9 | 10 | /// 11 | /// 最后更新时间 12 | /// 13 | public DateTime ModifyTime { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Entities/ISoftDelete.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface ISoftDelete 4 | { 5 | bool IsDeleted { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Data; 2 | global using System.Linq.Expressions; 3 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interceptor/Castle/UowInterceptor.cs: -------------------------------------------------------------------------------- 1 | using Castle.DynamicProxy; 2 | 3 | namespace Adnc.Infra.Repository.Interceptor.Castle; 4 | 5 | /// 6 | /// 工作单元拦截器 7 | /// 8 | public class UowInterceptor(UowAsyncInterceptor uowAsyncInterceptor) : IInterceptor 9 | { 10 | public void Intercept(IInvocation invocation) 11 | { 12 | uowAsyncInterceptor.ToInterceptor().Intercept(invocation); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interceptor/UnitOfWorkAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository.Interceptor; 2 | 3 | [AttributeUsage(AttributeTargets.Method, Inherited = true)] 4 | public class UnitOfWorkAttribute : Attribute 5 | { 6 | /// 7 | /// 需要把事务共享给CAP 8 | /// 9 | public bool Distributed { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/DbTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public enum DbTypes 4 | { 5 | MYSQL = 1001, 6 | SQLSERVER = 1002, 7 | ORACLE = 1004, 8 | UNKNOW = 0 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/IAdoExecuterWithQuerierRepository.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IAdoExecuterWithQuerierRepository : IAdoExecuterRepository, IAdoQuerierRepository 4 | { } 5 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/IAdoRepository.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IAdoRepository : IRepository 4 | { 5 | void ChangeOrSetDbConnection(IDbConnection dbConnection); 6 | 7 | [Obsolete($"use {nameof(CreateDbConnection)} instead")] 8 | IDbConnection ChangeOrSetDbConnection(string connectionString, DbTypes dbType); 9 | 10 | IDbConnection CreateDbConnection(string connectionString, DbTypes dbType); 11 | 12 | bool HasDbConnection(); 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/IRepository.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | /// 4 | /// 仓储基类接口 5 | /// 6 | /// 7 | public interface IRepository where TEntity : class 8 | { } 9 | 10 | public interface IRepository 11 | { } 12 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public interface IUnitOfWork : IDisposable 4 | { 5 | bool IsStartingUow { get; } 6 | 7 | void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, bool distributed = false); 8 | 9 | void Rollback(); 10 | 11 | void Commit(); 12 | 13 | Task RollbackAsync(CancellationToken cancellationToken = default); 14 | 15 | Task CommitAsync(CancellationToken cancellationToken = default); 16 | } 17 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/Models/Operater.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public class Operater 4 | { 5 | public long Id { get; set; } 6 | 7 | public string Account { get; set; } = default!; 8 | 9 | public string Name { get; set; } = default!; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructures/Repository/Interface/RepositoryConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Repository; 2 | 3 | public static class RepositoryConsts 4 | { 5 | public static readonly string MYCAT_ROUTE_TO_MASTER = "#mycat:db_type=master"; 6 | public static readonly string MAXSCALE_ROUTE_TO_MASTER = "maxscale route to master"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/Infrastructures/logo.png -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Adnc.Shared.Application.Contracts.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该层定义了DTO对象的基类、应用服务类基类、缓存相关服务基类以及操作日志拦截器、UnitOfWork拦截器。所有微服务Application层的共享层,并且都需要依赖该层。 4 | Adnc.Shared.Application.Contracts 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Attributes/OperateLogAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Attributes; 2 | 3 | [AttributeUsage(AttributeTargets.Method, Inherited = true)] 4 | public class OperateLogAttribute : Attribute 5 | { 6 | public string LogName { get; set; } = string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/IDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// DTO 基类 5 | /// 6 | public interface IDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/IdDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | [Serializable] 4 | public sealed class IdDto : OutputDto 5 | { 6 | public IdDto() 7 | { 8 | } 9 | 10 | public IdDto(long id) 11 | { 12 | Id = id; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/InputDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 输入DTO基类 5 | /// 6 | public abstract class InputDto : IDto 7 | { } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/InputSimpleDto.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Adnc.Shared.Application.Contracts.Dtos; 4 | 5 | /// 6 | /// 用于解决API frompost 方式接收 string,int,long等基础类型的问题。 7 | /// 8 | /// 9 | [Serializable] 10 | public class InputSimpleDto : IDto 11 | where T : notnull 12 | { 13 | /// 14 | /// 需要传递的值 15 | /// 16 | [Required] 17 | public T Value { get; set; } = default!; 18 | } 19 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/MongoDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | public abstract class MongoDto : IDto 4 | { 5 | public string Id { get; set; } = string.Empty; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/OptionDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | public sealed class OptionTreeDto 4 | { 5 | public string Label { get; set; } = string.Empty; 6 | 7 | public long Value { get; set; } 8 | 9 | public List Children { get; set; } = []; 10 | } 11 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/OutputBaseAuditDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | [Serializable] 4 | public abstract class OutputBaseAuditDto : OutputDto 5 | { 6 | /// 7 | /// 创建人 8 | /// 9 | public virtual long CreateBy { get; set; } 10 | 11 | /// 12 | /// 创建时间/注册时间 13 | /// 14 | public virtual DateTime CreateTime { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/OutputDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | [Serializable] 4 | public abstract class OutputDto : IDto 5 | { 6 | public virtual long Id { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/OutputFullAuditInfoDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// Dto基类 5 | /// 6 | [Serializable] 7 | public abstract class OutputFullAuditInfoDto : OutputBaseAuditDto 8 | { 9 | /// 10 | /// 最后更新人 11 | /// 12 | public virtual long ModifyBy { get; set; } 13 | 14 | /// 15 | /// 最后更新时间 16 | /// 17 | public virtual DateTime ModifyTime { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/SearchDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | public abstract class SearchDto : IDto 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Dtos/SimpleDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | /// 4 | /// 用于解决返回基本类型 5 | /// 6 | /// 7 | [Serializable] 8 | public class SimpleDto : IDto 9 | where T : notnull 10 | { 11 | public SimpleDto() 12 | { 13 | } 14 | 15 | public SimpleDto(T value) 16 | { 17 | Value = value; 18 | } 19 | 20 | /// 21 | /// 需要传递的值 22 | /// 23 | public T Value { get; set; } = default!; 24 | } 25 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Enums/TrackerKind.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Enums; 2 | 3 | public enum TrackerKind 4 | { 5 | Null = 0x01, 6 | Db = 0x02, 7 | Redis = 0x04 8 | } 9 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Net; 2 | global using System.Text.Json; 3 | global using System.Text.Json.Serialization; 4 | global using Adnc.Infra.Core.Json; 5 | global using FluentValidation; 6 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Interfaces/IAppService.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Interfaces; 2 | 3 | public interface IAppService 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Application.Contracts/Interfaces/IMessageTracker.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Shared.Application.Contracts.Enums; 2 | 3 | namespace Adnc.Shared.Application.Contracts.Interfaces; 4 | 5 | public interface IMessageTracker 6 | { 7 | TrackerKind Kind { get; } 8 | Task HasProcessedAsync(long eventId, string trackerName); 9 | Task MarkAsProcessedAsync(long eventId, string trackerName); 10 | } 11 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Extensions/HttpClientBuilderExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Extensions.DependencyInjection; 2 | 3 | public static class HttpClientBuilderExtension 4 | { 5 | public static IHttpClientBuilder AddPolicyHandlers(this IHttpClientBuilder builder, List> policies) 6 | { 7 | policies?.ForEach(policy => builder.AddPolicyHandler(policy)); 8 | return builder; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Extensions/MessageTrackerExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Interfaces; 2 | 3 | public static class MessageTrackerExtension 4 | { 5 | public static async Task HasProcessedAsync(this IMessageTracker tracker, Remote.Event.EventEntity eventDto) 6 | { 7 | return await tracker.HasProcessedAsync(eventDto.Id, eventDto.EventTarget); 8 | } 9 | 10 | public static async Task MarkAsProcessedAsync(this IMessageTracker tracker, Remote.Event.EventEntity eventDto) 11 | { 12 | await tracker.MarkAsProcessedAsync(eventDto.Id, eventDto.EventTarget); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Extensions/SearchPagedDtoExtension.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Contracts.Dtos; 2 | 3 | public static class SearchPagedDtoExtension 4 | { 5 | /// 6 | /// 计算查询需要跳过的行数 7 | /// 8 | /// 9 | /// 10 | public static int SkipRows(this SearchPagedDto dto) => (dto.PageIndex - 1) * dto.PageSize; 11 | } 12 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Interceptors/OperateLog/OperateLogInterceptor.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Interceptors; 2 | 3 | /// 4 | /// 操作日志拦截器 5 | /// 6 | public class OperateLogInterceptor(OperateLogAsyncInterceptor opsLogAsyncInterceptor) : IInterceptor 7 | { 8 | public void Intercept(IInvocation invocation) 9 | { 10 | opsLogAsyncInterceptor.ToInterceptor().Intercept(invocation); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Mapper/IObjectMapper.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Mapper; 2 | 3 | public interface IObjectMapper 4 | { 5 | TDestination Map(object source); 6 | 7 | TDestination Map(TSource source) 8 | where TSource : class 9 | where TDestination : class; 10 | 11 | TDestination Map(TSource source, TDestination destination) 12 | where TSource : class 13 | where TDestination : class; 14 | 15 | TDestination Map(object source, long id) 16 | where TDestination : Entity; 17 | } 18 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Registrar/AbstractApplicationDependencyRegistrar.DomainSerivces.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Registrar; 2 | 3 | public abstract partial class AbstractApplicationDependencyRegistrar 4 | { 5 | /// 6 | /// 注册Domain服务 7 | /// 8 | protected virtual void AddDomainSerivces() 9 | where TDomainService : class 10 | { 11 | var serviceType = typeof(TDomainService); 12 | var implTypes = RepositoryOrDomainLayerAssembly.ExportedTypes.Where(type => type.IsAssignableTo(serviceType) && type.IsNotAbstractClass(true)).ToList(); 13 | implTypes?.ForEach(implType => 14 | { 15 | Services.Add(new ServiceDescriptor(implType, implType, Lifetime)); 16 | }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Services/Trackers/MessageTrackerFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Services.Trackers; 2 | 3 | public sealed class MessageTrackerFactory(IEnumerable trackers) 4 | { 5 | public IEnumerable _trackers = trackers; 6 | 7 | public IMessageTracker Create(TrackerKind kind = TrackerKind.Db) 8 | { 9 | if (_trackers.IsNullOrEmpty()) 10 | { 11 | return new NullMessageTrackerService(); 12 | } 13 | 14 | return _trackers.FirstOrDefault(x => x.Kind == kind) ?? new NullMessageTrackerService(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Services/Trackers/NullMessageTrackerService.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Services.Trackers; 2 | 3 | public class NullMessageTrackerService : IMessageTracker 4 | { 5 | public TrackerKind Kind => TrackerKind.Null; 6 | public async Task HasProcessedAsync(long eventId, string trackerName) => await Task.FromResult(false); 7 | public async Task MarkAsProcessedAsync(long eventId, string trackerName) => await Task.CompletedTask; 8 | } 9 | -------------------------------------------------------------------------------- /src/ServiceShared/Application/Services/Trackers/RedisMessageTrackerService.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Application.Services.Trackers; 2 | 3 | public class RedisMessageTrackerService : IMessageTracker 4 | { 5 | public TrackerKind Kind => TrackerKind.Redis; 6 | 7 | public async Task HasProcessedAsync(long eventId, string trackerName) 8 | { 9 | return await Task.FromResult(false); 10 | } 11 | 12 | public async Task MarkAsProcessedAsync(long eventId, string trackerName) 13 | { 14 | await Task.CompletedTask; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Adnc.Shared.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该库是提供所有Domain层的公共实现。 4 | Adnc.Shared.Domain 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Entities/AbstractDomainEntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain.Entities; 2 | 3 | public abstract class AbstractDomainEntityInfo : AbstractEntityInfo, IEntityInfo 4 | { 5 | protected override List GetEntityTypes(IEnumerable assemblies) 6 | { 7 | var typeList = assemblies.SelectMany(assembly => assembly.GetTypes() 8 | .Where(m => m.FullName != null 9 | && (typeof(AggregateRoot).IsAssignableFrom(m) || typeof(DomainEntity).IsAssignableFrom(m)) 10 | && !m.IsAbstract)) ?? []; 11 | return typeList.Append(typeof(EventTracker)).ToList(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Entities/AggregateRoot.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain.Entities; 2 | 3 | public abstract class AggregateRoot : DomainEntity, IConcurrency, IEfEntity 4 | { 5 | public Lazy EventPublisher => new(() => 6 | { 7 | return ServiceLocator.GetProvider().GetRequiredService(); 8 | }); 9 | 10 | public byte[] RowVersion { get; set; } = []; 11 | } 12 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Entities/AggregateRootWithBasicAuditInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain.Entities; 2 | 3 | public class AggregateRootWithBasicAuditInfo : AggregateRoot, IBasicAuditInfo 4 | { 5 | public long CreateBy { get; set; } 6 | public DateTime CreateTime { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Entities/DomainEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain.Entities; 2 | 3 | public class DomainEntity : Entity 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/Entities/ValueObject.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain.Entities; 2 | 3 | public record ValueObject 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Reflection; 2 | global using Adnc.Infra.Core.DependencyInjection; 3 | global using Adnc.Infra.EventBus; 4 | global using Adnc.Infra.Repository; 5 | global using Adnc.Infra.Repository.EfCore; 6 | global using Adnc.Shared.Repository.EfCoreEntities; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Domain/IDomainService.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Domain; 2 | 3 | public interface IDomainService 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Net.Http.Headers; 2 | global using Adnc.Infra.Helper; 3 | global using Microsoft.AspNetCore.Http; 4 | global using Microsoft.Extensions.DependencyInjection; 5 | global using Microsoft.Extensions.Logging; 6 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/BasicOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Handlers.Token; 2 | 3 | public sealed class BasicOptions 4 | { 5 | public string UserName { get; set; } = string.Empty; 6 | public string Password { get; set; } = string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/BasicTokenGenerator.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Options; 2 | 3 | namespace Adnc.Shared.Remote.Handlers.Token; 4 | 5 | public class BasicTokenGenerator(IHttpContextAccessor httpContextAccessor, IOptions basicOptions, ILogger logger) : ITokenGenerator 6 | { 7 | public static string Scheme => "Basic"; 8 | 9 | public string GeneratorName => Scheme; 10 | 11 | public virtual string Create() 12 | { 13 | var userContext = httpContextAccessor.HttpContext.RequestServices.GetService(); 14 | var userId = userContext is null ? 0 : userContext.Id; 15 | logger.LogDebug("UserContext:{userId}", userId); 16 | var token = BasicTokenValidator.PackToBase64(userId, basicOptions.Value); 17 | return token; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/BearerTokenGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Handlers.Token; 2 | 3 | public class BearerTokenGenerator(IHttpContextAccessor httpContextAccessor, ILogger logger) : ITokenGenerator 4 | { 5 | public static string Scheme => "Bearer"; 6 | 7 | public string GeneratorName => Scheme; 8 | 9 | public string Create() 10 | { 11 | var token = httpContextAccessor.HttpContext.Request.Headers["Authorization"].FirstOrDefault(); 12 | var tokenTxt = token?.Remove(0, 7); 13 | logger.LogDebug("Accessor:{tokenTxt}", tokenTxt); 14 | return tokenTxt ?? string.Empty; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/ITokenGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Handlers.Token; 2 | 3 | public interface ITokenGenerator 4 | { 5 | public static string Scheme { get; } = string.Empty; 6 | 7 | public string GeneratorName { get; } 8 | 9 | /// 10 | /// 创建/获取一个token 11 | /// 12 | /// 13 | public string Create(); 14 | } 15 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/TokenFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Handlers.Token; 2 | 3 | public sealed class TokenFactory(IEnumerable tokenGenerators) 4 | { 5 | public ITokenGenerator CreateGenerator(string authorizationScheme) 6 | { 7 | /* 8 | if (authorizationScheme.EqualsIgnoreCase(BasicTokenGenerator.Scheme)) 9 | return ActivatorUtilities.CreateInstance(_provider); 10 | 11 | if (authorizationScheme.EqualsIgnoreCase(BearerTokenGenerator.Scheme)) 12 | return ActivatorUtilities.CreateInstance(_provider); 13 | 14 | return default; 15 | */ 16 | var tokenGenerator = tokenGenerators.First(x => x.GeneratorName == authorizationScheme); 17 | return tokenGenerator; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Handlers/Token/UnPackedResult.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Handlers.Token; 2 | 3 | public class UnPackedResult(bool isSuccessful, string? userName, long? userId) 4 | { 5 | public bool IsSuccessful { get; set; } = isSuccessful; 6 | public string? UserName { get; set; } = userName; 7 | public long? UserId { get; set; } = userId; 8 | } 9 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Http/IRestClient.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Http; 2 | 3 | public interface IRestClient 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Http/Messages/LoginResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Http.Messages; 2 | 3 | public class LoginResponse 4 | { 5 | /// 6 | /// 构造函数 7 | /// 修复Warning, add by garfield 20220530 8 | /// 9 | public LoginResponse(string token, string refreshToken) => (Token, RefreshToken) = (token, refreshToken); 10 | 11 | public string Token { get; set; } 12 | 13 | public string RefreshToken { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/Http/Messages/UserValidatedInfoResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote.Http.Messages; 2 | 3 | public record UserValidatedInfoResponse 4 | { 5 | public bool Status { get; set; } 6 | 7 | public string ValidationVersion { get; set; } = string.Empty; 8 | } 9 | -------------------------------------------------------------------------------- /src/ServiceShared/Remote/RpcInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Remote; 2 | 3 | public sealed class RpcInfo 4 | { 5 | public List Address { get; set; } = []; 6 | 7 | public PollyNode Polly { get; set; } = new(); 8 | 9 | public class AddressNode 10 | { 11 | public string Service { get; set; } = string.Empty; 12 | public string Direct { get; set; } = string.Empty; 13 | public string Consul { get; set; } = string.Empty; 14 | public string CoreDns { get; set; } = string.Empty; 15 | } 16 | 17 | public class PollyNode 18 | { 19 | public bool Enable { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ServiceShared/Repository/Adnc.Shared.Repository.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 该层定义了仓储层基类。 4 | Adnc.Shared.Repository 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/ServiceShared/Repository/DapperEntities/LoginLog.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Repository.DapperEntities; 2 | 3 | /// 4 | /// login log 5 | /// 6 | public class LoginLog : Entity 7 | { 8 | public string Device { get; set; } = string.Empty; 9 | 10 | public string Message { get; set; } = string.Empty; 11 | 12 | public bool Succeed { get; set; } 13 | 14 | public int StatusCode { get; set; } 15 | 16 | public long UserId { get; set; } 17 | 18 | public string Account { get; set; } = string.Empty; 19 | 20 | public string Name { get; set; } = string.Empty; 21 | 22 | public string RemoteIpAddress { get; set; } = string.Empty; 23 | 24 | public int ExecutionTime { get; set; } 25 | 26 | public DateTime CreateTime { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/ServiceShared/Repository/EfCoreEntities/Config/EventTrackerConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Repository.EfCoreEntities.Config; 2 | 3 | public class EventTrackerConfig : IEntityTypeConfiguration 4 | { 5 | public void Configure(EntityTypeBuilder builder) 6 | { 7 | builder.Property(x => x.TrackerName).HasMaxLength(50); 8 | builder.HasIndex(x => new { x.EventId, x.TrackerName }, "uk_eventid_trackername").IsUnique(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ServiceShared/Repository/EfCoreEntities/EventTracker.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.Repository.EfCoreEntities; 2 | 3 | /// 4 | /// 事件跟踪/处理信息 5 | /// 6 | /// 7 | /// EventId,TrackerName 需要建联合唯一索引 8 | /// CREATE UNIQUE INDEX UK_EventId_TrackerNam ON EventTracker(EventId, TrackerName); 9 | /// 10 | public class EventTracker : EfBasicAuditEntity 11 | { 12 | public long EventId { get; set; } 13 | 14 | public string TrackerName { get; set; } = string.Empty; 15 | } 16 | -------------------------------------------------------------------------------- /src/ServiceShared/Repository/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Repository; 2 | global using Microsoft.EntityFrameworkCore; 3 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | -------------------------------------------------------------------------------- /src/ServiceShared/Shared/Adnc.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 所有服务都需要依赖该工程 4 | adnc,adnc.shared 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ServiceShared/Shared/UserContext.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared; 2 | 3 | public sealed class UserContext 4 | { 5 | public long Id { get; set; } 6 | public string Account { get; set; } = string.Empty; 7 | public string Name { get; set; } = string.Empty; 8 | public string Email { get; set; } = string.Empty; 9 | public string RoleIds { get; set; } = string.Empty; 10 | public string Device { get; set; } = string.Empty; 11 | public string RemoteIpAddress { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Basic/BasicDefaults.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Basic; 2 | 3 | public static class BasicDefaults 4 | { 5 | public const string AuthenticationScheme = "Basic"; 6 | public const string NameId = "NameId"; 7 | public const string UniqueName = "UniqueName"; 8 | public const string Name = "Name"; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Basic/BasicEvents.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Basic; 2 | 3 | public class BasicEvents 4 | { 5 | public Func OnTokenValidated { get; set; } = default!; 6 | 7 | //public virtual Task TokenValidated(BasicTokenValidatedContext context) => OnTokenValidated(context); 8 | } 9 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Basic/BasicPostConfigureOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Basic; 2 | 3 | public class BasicPostConfigureOptions : IPostConfigureOptions 4 | { 5 | public void PostConfigure(string? name, BasicSchemeOptions options) 6 | { 7 | // Method intentionally left empty. 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Basic/BasicSchemeOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Basic; 2 | 3 | public class BasicSchemeOptions : AuthenticationSchemeOptions 4 | { 5 | public BasicSchemeOptions() 6 | { 7 | Events = new BasicEvents(); 8 | } 9 | 10 | public new BasicEvents Events 11 | { 12 | get { return base.Events is null ? new BasicEvents() : (BasicEvents)base.Events; } 13 | set { base.Events = value; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Basic/BasicTokenValidatedContext.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Basic; 2 | 3 | public class BasicTokenValidatedContext(HttpContext context, AuthenticationScheme scheme, BasicSchemeOptions options) : ResultContext(context, scheme, options) 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Bearer/BearerDefaults.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Bearer; 2 | 3 | public static class BearerDefaults 4 | { 5 | public const string RoleIds = "roleids"; 6 | public const string LoginerType = "loginer"; 7 | public const string Manager = "manager"; 8 | public const string Customer = "customer"; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Bearer/JwtToken.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Bearer; 2 | 3 | public record JwtToken 4 | { 5 | public JwtToken(string token, DateTime expire) 6 | { 7 | Token = token; 8 | Expire = expire; 9 | } 10 | 11 | public string Token { get; set; } 12 | public DateTime Expire { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Bearer/Tokens.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Bearer; 2 | 3 | public enum Tokens 4 | { 5 | AccessToken = 1, 6 | RefreshToken = 2 7 | } 8 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Hybrid/HybridDefaults.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Hybrid; 2 | 3 | public static class HybridDefaults 4 | { 5 | public const string AuthenticationScheme = "Hybrid"; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Hybrid/HybridPostConfigureOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Hybrid; 2 | 3 | public class HybridPostConfigureOptions : IPostConfigureOptions 4 | { 5 | public void PostConfigure(string? name, HybridSchemeOptions options) 6 | { 7 | // Method intentionally left empty. 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authentication/Hybrid/HybridSchemeOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authentication.Hybrid; 2 | 3 | public class HybridSchemeOptions : AuthenticationSchemeOptions 4 | { } 5 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authorization/AuthorizePolicy.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authorization; 2 | 3 | public static class AuthorizePolicy 4 | { 5 | public static readonly string Default = "default"; 6 | } 7 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Authorization/PermissionRequirement.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Authorization; 2 | 3 | public class PermissionRequirement : IAuthorizationRequirement 4 | { 5 | public PermissionRequirement() 6 | { 7 | } 8 | 9 | public PermissionRequirement(string name) => Name = name; 10 | public string Name { get; init; } = string.Empty; 11 | } 12 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/Registrar/AbstractWebApiDependencyRegistrar.MiniProfiler.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi.Registrar; 2 | 3 | public abstract partial class AbstractWebApiDependencyRegistrar 4 | { 5 | /// 6 | /// 注册 MiniProfiler 组件 7 | /// 8 | protected virtual void AddMiniProfiler() 9 | { 10 | var profilerPath = $"/{ServiceInfo.RelativeRootPath}/profiler"; 11 | Services 12 | .AddMiniProfiler(options => options.RouteBasePath = profilerPath) 13 | .AddEntityFramework(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ServiceShared/WebApi/ThreadPoolSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Shared.WebApi; 2 | 3 | public sealed class ThreadPoolSettings 4 | { 5 | public int MinThreads { get; set; } = 300; 6 | public int MinCompletionPortThreads { get; set; } = 300; 7 | public int MaxThreads { get; set; } = 32767; 8 | public int MaxCompletionPortThreads { get; set; } = 1000; 9 | } 10 | -------------------------------------------------------------------------------- /src/ServiceShared/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/ServiceShared/logo.png -------------------------------------------------------------------------------- /src/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/src/logo.png -------------------------------------------------------------------------------- /test/Unittest.Consul/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Consul; 2 | global using Adnc.Infra.Unittest.Consul.Fixtures; 3 | global using Microsoft.Extensions.Configuration; 4 | global using Microsoft.Extensions.DependencyInjection; 5 | global using System; 6 | global using Xunit.Abstractions; 7 | -------------------------------------------------------------------------------- /test/Unittest.Consul/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Consul": { 3 | "ConsulUrl": "http://62.234.187.128:8500", 4 | "ConsulKeyPath": "adnc/staging/gateway/appsettings", 5 | "ServiceName": "adnc-unittest-consul", 6 | "ServerTags": [ "urlprefix-/unittest" ], 7 | "HealthCheckUrl": "$RELATIVEROOTPATH/health-24b01005-a76a-4b3b-8fb1-5e0f2e9564fb", 8 | "HealthCheckIntervalInSecond": 6, 9 | "DeregisterCriticalServiceAfter": 20, 10 | "Timeout": 6 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/Unittest.Helper/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Helper; 2 | global using Adnc.Infra.Helper.Internal.Encrypt.Shared; 3 | global using System.Security.Cryptography; 4 | -------------------------------------------------------------------------------- /test/Unittest.Helper/TestCases/HMACMD5_Tests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Xunit; 5 | 6 | namespace Adnc.Infra.Unittest.Helper.Tests 7 | { 8 | public class HMACMD5_Tests 9 | { 10 | private const string key = "hjajsfp[1nj;ko"; 11 | 12 | [Fact(DisplayName = "HMACMD5 success test")] 13 | public void HMACMD5_Success_Test() 14 | { 15 | var srcString = "hmacmd5 value"; 16 | 17 | //Act 18 | var hashed = InfraHelper.Encrypt.Md5HMAC(srcString, key); 19 | 20 | //Assert 21 | Assert.NotEmpty(hashed); 22 | Assert.Equal("625796ca4bee402ce9b0bf048a7eda6d", hashed.ToLower()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Unittest.Redis/Fixtures/FixtureConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Redis.Fixtures; 2 | 3 | internal static class FixtureConsts 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /test/Unittest.Redis/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Redis; 2 | global using Adnc.Infra.Redis.Caching; 3 | global using Adnc.Infra.Unittest.Redis.Fixtures; 4 | global using Microsoft.Extensions.Configuration; 5 | global using Microsoft.Extensions.DependencyInjection; 6 | global using System; 7 | global using Xunit.Abstractions; 8 | -------------------------------------------------------------------------------- /test/Unittest.Redis/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Redis": { 3 | "Provider": "StackExchange", 4 | "EnableLogging": true, 5 | "SerializerName": "json", 6 | "EnableBloomFilter": false, 7 | "Dbconfig": { 8 | "ConnectionString": "62.234.187.128:13379,password=football,defaultDatabase=0,ssl=false,sslHost=null,connectTimeout=4000,allowAdmin=true" 9 | } 10 | }, 11 | "Caching": { 12 | "MaxRdSecond": 30, 13 | "LockMs": 6000, 14 | "SleepMs": 300, 15 | "EnableLogging": true, 16 | "PollyTimeoutSeconds": 11, 17 | "PenetrationSetting": { 18 | "Disable": false, 19 | "BloomFilterSetting": { 20 | "Name": "adnc:unittest:bloomfilter:cachekeys", 21 | "Capacity": 10000000, 22 | "ErrorRate": 0.001 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Unittest.Repository.MongoDb/Fixtures/Entities/EntityInfoMongoDb.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Infra.Repository.EfCore.MongoDB; 2 | using MongoDB.EntityFrameworkCore.Extensions; 3 | 4 | namespace Adnc.Infra.Unittest.Reposity.MongoDb.Fixtures.Entities; 5 | 6 | public class MongoEntityInfo : AbstractMongoDbEntityInfo 7 | { 8 | protected override List GetEntityAssemblies() => [GetType().Assembly]; 9 | 10 | protected override void SetCollectionName(ModelBuilder modelBuilder) 11 | { 12 | modelBuilder.Entity().ToCollection("logger_log"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Unittest.Repository.MongoDb/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Repository; 2 | global using Microsoft.EntityFrameworkCore; 3 | global using Microsoft.Extensions.DependencyInjection; 4 | global using System.Reflection; 5 | global using Xunit.Abstractions; 6 | -------------------------------------------------------------------------------- /test/Unittest.Repository.MongoDb/adnc_cust_unittest.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/test/Unittest.Repository.MongoDb/adnc_cust_unittest.sql -------------------------------------------------------------------------------- /test/Unittest.Repository.MongoDb/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_cust_unittest;uid=unittest;pwd=football;connection timeout=10;" 4 | }, 5 | "MongoDb": { 6 | "ConnectionString": "mongodb://alpha:football@62.234.187.128:13017?authSource=logs_dev", 7 | "DataBase": "logs_dev", 8 | "CollectionNamingConvention": 2, 9 | "PluralizeCollectionNames": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Dtos/CustmerDto.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Dtos; 2 | 3 | public class CustomerDto 4 | { 5 | public string Nickname { get; set; } = string.Empty; 6 | 7 | public string Realname { get; set; } = string.Empty; 8 | 9 | public string Password { get; set; } = string.Empty; 10 | } 11 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/Config/CustomerFinanceConfig.cs: -------------------------------------------------------------------------------- 1 | using Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 2 | 3 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities.Config; 4 | 5 | public class CustomerFinanceConfig : AbstractEntityTypeConfiguration 6 | { 7 | public override void Configure(EntityTypeBuilder builder) 8 | { 9 | base.Configure(builder); 10 | 11 | builder.Property(x => x.Account).IsRequired().HasMaxLength(CustomerFinanceConsts.Account_MaxLength); 12 | builder.Property(x => x.Balance).IsRequired().HasColumnType("decimal(18,4)"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/Config/ProjectConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities.Config; 2 | 3 | public class ProjectConfig : AbstractEntityTypeConfiguration 4 | { 5 | public override void Configure(EntityTypeBuilder builder) 6 | { 7 | base.Configure(builder); 8 | builder.Property(x => x.Name).IsRequired().HasMaxLength(ProjectConsts.Name_MaxLength); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/Customer.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 2 | 3 | /// 4 | /// 客户表 5 | /// 6 | public class Customer : EfFullAuditEntity 7 | { 8 | public string Account { get; set; } 9 | 10 | public string Password { get; set; } = string.Empty; 11 | 12 | public string Nickname { get; set; } 13 | 14 | public string Realname { get; set; } 15 | 16 | public virtual CustomerFinance FinanceInfo { get; set; } 17 | 18 | public virtual ICollection TransactionLogs { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/CustomerFinance.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 2 | 3 | /// 4 | /// 客户财务表 5 | /// 6 | public class CustomerFinance : EfFullAuditEntity, IConcurrency 7 | { 8 | public string Account { get; set; } 9 | 10 | public decimal Balance { get; set; } 11 | 12 | public virtual Customer Customer { get; set; } 13 | 14 | public byte[] RowVersion { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/EntityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 2 | 3 | public class EntityInfo : AbstractEntityInfo 4 | { 5 | protected override List GetEntityAssemblies() => [GetType().Assembly]; 6 | 7 | protected override void SetTableName(ModelBuilder modelBuilder) 8 | { 9 | //builder.Entity().ToTable("eventtracker"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/Entities/Project.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 2 | 3 | /// 4 | /// 工程表,仅用于测试,无实际意义 5 | /// 6 | public class Project : EfFullAuditEntity, ISoftDelete, IConcurrency 7 | { 8 | public string Name { get; set; } 9 | 10 | public bool IsDeleted { get; set; } 11 | 12 | public byte[] RowVersion { get; set; } = Array.Empty(); 13 | } 14 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/FixtureConsts.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures; 2 | 3 | internal static class FixtureConsts 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /test/Unittest.Repository/Fixtures/UnittestHelper.cs: -------------------------------------------------------------------------------- 1 | namespace Adnc.Infra.Unittest.Reposity.Fixtures; 2 | 3 | internal class UnittestHelper 4 | { 5 | public static long GetNextId() 6 | { 7 | Task.Delay(2).Wait(); 8 | return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/Unittest.Repository/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Adnc.Infra.Repository; 2 | global using Adnc.Infra.Repository.EfCore; 3 | global using Adnc.Infra.Unittest.Reposity.Fixtures; 4 | global using Adnc.Infra.Unittest.Reposity.Fixtures.Entities; 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | global using System.Linq.Expressions; 9 | global using System.Reflection; 10 | global using Xunit.Abstractions; 11 | -------------------------------------------------------------------------------- /test/Unittest.Repository/adnc_cust_unittest.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlphaYu/adnc/8744d29858cb939ff104a8215a0069adfd6362c4/test/Unittest.Repository/adnc_cust_unittest.sql -------------------------------------------------------------------------------- /test/Unittest.Repository/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Mysql": { 3 | "ConnectionString": "Server=62.234.187.128;Port=13308;database=adnc_cust_unittest;uid=unittest;pwd=football;connection timeout=10;" 4 | }, 5 | "MongoDb": { 6 | "ConnectionString": "mongodb://alpha:football@62.234.187.128:13017?authSource=logs_dev", 7 | "DataBase": "logs_dev", 8 | "CollectionNamingConvention": 2, 9 | "PluralizeCollectionNames": true 10 | } 11 | } 12 | --------------------------------------------------------------------------------