勿以恶小而为之,勿以善小而不为。”——刘备
源码: /// 字符串压缩 public static string CompressString(string str) { string compressString = ""; byte[] compressBeforeByte = Encoding.UTF8.GetBytes(str
net core 中跨域设置代码如下: // 设置跨域 services.AddCors(options => { options.AddPolicy("domains_all", builder => {
在vs调试中出现断点无效,一般情况是优化了代码, 取消优化码即可正常使用断点 <p><img src="/zb_users/upload/2022/03/202203311648693414892154.png" alt="image.png"/></p>
实体类转json,不显示空值字段: <p><img src="/zb_users/upload/2022/03/202203311648693519829226.png" alt="image.png"/></p> 代码: /// <summary> /// 转Json字符串,删除空值字段 /// </summary>
在Vs中点击团队资源管理器: <p><img src="/zb_users/upload/2022/03/202203311648693109421854.png" alt="image.png"/></p> 在工作区选择设置: <p><img src="/zb_users/upload/2022/03/202203311648692989861830.png" alt="image
var menus = new MongoDbHelper<Entitys.Menus>().ListAllAsync(); MongoDbHelper<RoleForMenuAuthority> rfma = new(); var rtnlist = new List<MenusRoleAuthorityView>();
ConfigureService中添加以下代码: services.AddSwaggerGen(c => { c.SwaggerDoc("v1.1", new OpenApiInfo { Title = "接口文档", Version = "v1.1", Description = "API文档全部由代码自动生成" }); var filePath = Pat
app.UseStaticFiles(new StaticFileOptions { //资源所在的绝对路径。 FileProvider = new PhysicalFileProvider(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "Doc")), //表示访问路径,必须'/'开头
core net 6.0读取appsetting.json节点数据: appsetting.json 文件内容: { "ConnectionStrings": { //数据库连接字符串 "Connstr": "Server=127.0.0.1;Database=Test;Trusted_Connection=True;MultipleActiveResultSets=tru
//1,添加 Serilog NuGet程序包 //2,在ConfigureServices 中添加以下代码 Log.Logger = new LoggerConfiguration() //错误信息 .MinimumLevel.Error() .MinimumLevel.Override("System", Serilog.Events.LogEventLevel.Error)