# dotnet8-example **Repository Path**: byref/dotnet8-example ## Basic Information - **Project Name**: dotnet8-example - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-01-20 - **Last Updated**: 2024-01-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 已实现功能 1. 使用autofac, 完成aop功能 2. 使用knife4ui做为swagger-ui 3. Controller配置全局过滤器 4. 实现Repository模式(自动注入实现:RepositoryBase的子类, 实现IService的子类) 5. 促成AutoMapper 6. 时间字段JSON格式化问题 7. 自定义JwtAuthentication, 新增认证异常时的Middleware,可以抛出401异常JSON数据 8. 自定义支持Yaml文件配置(支持kebab变更命名方式,支持变量大小写忽略) 9. 简单使用注解方式实现数据库事务 10. 简单使用注解方式实现缓存 11. 使用Steeltoe的PlaceHolderCore组件实现配置中使用Placeholder功能, Placeholder的值为以为一个环境变量 12. serilog集成,完成自定义Enricher,使用短路径展示SourceContext 13. 池化EfCore的DbContext 14. 简单实现Spring的@ConfigurationProperties功能, 自定义注解:ConfigurationPropertiesAttirubte 15. Naocs集成 16. Dotnet8打docker镜像 17. Refit集成Nacos服务发现功能 ## TODO 1. 集成Rabbitmq, EventBus 2. 集成Dapper功能, 简单实现mybatis的动态查询功能 ## 参考 ### refit https://www.nuget.org/packages/refit.httpclientfactory#setting-request-headers ### nacos集成 https://github.com/nacos-group/nacos-sdk-csharp ### EfCore池化 https://www.cnblogs.com/xhubobo/p/16163949.html ### docker构建 https://learn.microsoft.com/zh-cn/dotnet/core/docker/build-container?tabs=windows&pivots=dotnet-8-0 ### redis autofac使用配置方式注入 ### automapper: 自动扫描注解注册功能 在dto新增注解: AutoMapAttribute ```c# var assembly = typeof(Program).Assembly; // 1. 依赖注入时加入对程序集的扫描 builder.Services.AddAutoMapper(assembly); // 2. 手机注册(autofac) var configuration = new MapperConfiguration(cfg => // cfg.AddProfile() cfg.AddMaps(_assembly)); var mapper = new Mapper(configuration); builder.RegisterInstance(mapper).AsImplementedInterfaces(); ``` ### yaml配置 https://www.cnblogs.com/nianming/p/7097338.html ### knifeUI支持 参考: https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI ### FluentValidation ### AsyncLocal 使用AsyncLocal+ActionFilter完成用户上下文功能 ### JWT 参考:https://github.com/jwt-dotnet/jwt ## 问题