Amazing Grace

首页 新随笔 联系 管理

2024年4月25日 #

摘要: JSON序列化属性名由大写变成小写的问题 在 ASP.NET 中,默认情况下,JSON 序列化会将属性名转换为小写(camel case)以匹配 JSON 的约定。 如果您希望保留 C# 的命名约定(即属性名的大小写不变),您需要更改默认的 JSON 序列化器。 System.Text.Json 使 阅读全文
posted @ 2024-04-25 16:23 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

摘要: 数据库的设计 实体之间的关系图 实体 EleOrderRowItem.cs public class EleOrderRowItem : EleEntity { public string? Xxx { get; set; } // 外键:一个rowItem属于一个row public long R 阅读全文
posted @ 2024-04-25 12:06 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

摘要: 在 EF Core 中,如果查询查询外键表的内容 实体 public class Blog { public int BlogId { get; set; } public string Url { get; set; } public List<Post> Posts { get; set; } 阅读全文
posted @ 2024-04-25 11:47 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

2024年4月21日 #

摘要: 问题 [Route("api/[controller]")] [ApiController] public class UserController : ControllerBase { private readonly UserManager<IdentityUser> _userManager; 阅读全文
posted @ 2024-04-21 21:45 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

2024年4月16日 #

摘要: 获取当前程序所在的目录 // 获取当前程序的执行目录信息 Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); // asp.net使用,不过在console下也是 /xxx/bin/Debug/net8.0/ Console.Write 阅读全文
posted @ 2024-04-16 22:57 AmazingCookie 阅读(6) 评论(0) 推荐(0) 编辑

摘要: // 获取文件夹中后缀是txt的文件 string directoryPath = @"/Users/Code/Wechat.Crawler/Links"; string[] filePaths = Directory.GetFiles(directoryPath, "*.txt"); // 获取文 阅读全文
posted @ 2024-04-16 21:10 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

2024年4月15日 #

摘要: Wechat.Crawler/App/App.csproj <Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> <ProjectReference Include="..\Blog\Blog.csproj" /> </ItemGroup> <ItemGrou 阅读全文
posted @ 2024-04-15 22:38 AmazingCookie 阅读(3) 评论(0) 推荐(0) 编辑

2024年4月12日 #

摘要: vsvim的配置 set ai "自动缩进宽度 set sw=4 set ts=4 "关闭高亮显示 set nohlsearch set is set ignorecase set backspace=indent,eol,start set clipboard=unnamed set number 阅读全文
posted @ 2024-04-12 13:47 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

2024年4月10日 #

摘要: set ai "自动缩进宽度 set sw=4 set ts=4 "关闭高亮显示 set nohlsearch set is set ignorecase set backspace=indent,eol,start set clipboard=unnamed set number "Set <LE 阅读全文
posted @ 2024-04-10 20:10 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

2024年3月25日 #

摘要: @echo off setlocal enabledelayedexpansion rem 获取当前目录下的.zip文件 for %%f in (*.zip) do ( set "zipfile=%%f" ) rem 获取.zip文件的文件名(不带扩展名) for %%f in ("%zipfile 阅读全文
posted @ 2024-03-25 10:32 AmazingCookie 阅读(7) 评论(0) 推荐(0) 编辑

2024年3月24日 #

摘要: Trim的使用 These methods are designed for trimming characters from strings. Here's a breakdown of each method, along with examples of their usage: 1. Tri 阅读全文
posted @ 2024-03-24 15:05 AmazingCookie 阅读(2) 评论(0) 推荐(0) 编辑

2024年3月21日 #

摘要: 委托 特性 在C#中,委托是一个非常有用的特性,它 允许将方法作为参数传递给其他方法, 或者作为事件的处理器。 使用场景 委托的使用场景非常广泛,例如: 异步编程:委托可以用来指定回调方法,这在异步编程中非常有用。 事件处理:在.NET中,事件通常是通过委托来实现的,允许订阅和取消订阅事件。 LIN 阅读全文
posted @ 2024-03-21 19:39 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

2024年3月19日 #

摘要: 委托 在C#中,委托是一种类型,它安全地封装方法的签名和引用。 类似其他语言 委托类似于C或C++中的函数指针,但委托是类型安全的,并且是面向对象的。 委托的应用场景 委托特别用于实现事件和回调函数。 如何理解 理解委托的最简单方式是将它们视为能够指向具有特定签名的方法的变量。 一旦委托被赋值(即指 阅读全文
posted @ 2024-03-19 08:56 AmazingCookie 阅读(2) 评论(0) 推荐(0) 编辑

2024年3月17日 #

摘要: MacOS Selenium 跨浏览器环境搭建 在 macOS 上使用 Selenium 启动新版 Edge 的方式如下。 macOS 版本:10.15.5 Edge 版本:83.0.478.58 下载 83 版本对应的新版 Edge 驱动:https://developer.microsoft.c 阅读全文
posted @ 2024-03-17 11:35 AmazingCookie 阅读(8) 评论(0) 推荐(0) 编辑

2024年3月12日 #

摘要: 远程桌面 任务栏阻挡 怎么办 问题描述 Win10系统,开远程桌面连到其他机子的时候偶尔会出现本机的任务栏覆盖了远程桌面的任务栏。 解决办法 任务管理器中,重启 windows 资源管理器,搞定。 阅读全文
posted @ 2024-03-12 18:16 AmazingCookie 阅读(9) 评论(0) 推荐(0) 编辑

2024年3月7日 #

摘要: Program.cs和Startup.cs合并成Program.cs 合并Startup.cs到Program.cs: 将Startup.cs中的ConfigureServices方法中的代码移动到Program.cs中var builder = WebApplication.CreateBuild 阅读全文
posted @ 2024-03-07 23:25 AmazingCookie 阅读(5) 评论(0) 推荐(0) 编辑

摘要: ASP.NET 中的 Transient、Scoped 和 Singleton区别 该代码展示了 ASP.NET Core 中服务生命周期管理的不同选项,特别关注 Transient、Scoped 和 Singleton 服务。 说明 Transient: 每次请求都会创建一个新的 Operatio 阅读全文
posted @ 2024-03-07 23:11 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

2024年2月29日 #

摘要: Tornado.Send\Program.cs new TornadoSend().SendContentFromFive("这是测试消息"); Tornado.Send\Tornado.cs using System.Net; using System.Text; public class Tor 阅读全文
posted @ 2024-02-29 16:23 AmazingCookie 阅读(1) 评论(0) 推荐(0) 编辑

2024年2月27日 #

摘要: dotnet_miniapi_quartz_ipaddress_check/Dtos.cs using System.ComponentModel.DataAnnotations; namespace GameStore.Api.Dtos; public record IpAddressDto( G 阅读全文
posted @ 2024-02-27 18:47 AmazingCookie 阅读(10) 评论(0) 推荐(0) 编辑

2024年2月15日 #

摘要: 常驻后台的数据导出服务/常驻后台的数据导出服务.csproj <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <Nullable>enable</Nulla 阅读全文
posted @ 2024-02-15 23:13 AmazingCookie 阅读(8) 评论(0) 推荐(0) 编辑

摘要: Dotnet.Seer/SeerSocket.cs using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; namespace Seer.SeerSocket; public struct S 阅读全文
posted @ 2024-02-15 12:17 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

2024年2月14日 #

摘要: SeerAGV\Program.cs using Seer.SeerSocket; var seer = new SeerSocket(); var msg = seer.Send(0x0410,"""{"motor_names": ["motor1"]}""",19204); Console.W 阅读全文
posted @ 2024-02-14 17:07 AmazingCookie 阅读(3) 评论(0) 推荐(0) 编辑

2024年2月13日 #

摘要: 分布式缓存\appsettings.Development.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } } } 分布式缓存\appsettings.js 阅读全文
posted @ 2024-02-13 16:18 AmazingCookie 阅读(7) 评论(0) 推荐(0) 编辑

2024年2月12日 #

摘要: 托管服务1\1.txt this is a test file 托管服务1\appsettings.Development.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "War 阅读全文
posted @ 2024-02-12 16:10 AmazingCookie 阅读(6) 评论(0) 推荐(0) 编辑

2024年2月10日 #

摘要: DI魅力渐显_依赖注入\Program.cs services.AddScoped<IDbConnection>(sp => { string connStr = "Data Source=test.db"; var conn = new SqliteConnection(connStr); con 阅读全文
posted @ 2024-02-10 09:45 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

2024年2月9日 #

摘要: AddLogging的使用 services.AddLogging(logBuilder => { logBuilder.AddConsole(); }); AddLogging的实现 public static IServiceCollection AddLogging(this IService 阅读全文
posted @ 2024-02-09 22:59 AmazingCookie 阅读(8) 评论(0) 推荐(0) 编辑

摘要: AddConsole方法 // Summary: // Adds a console logger named 'Console' to the factory. // // Parameters: // builder: // The Microsoft.Extensions.Logging.IL 阅读全文
posted @ 2024-02-09 22:54 AmazingCookie 阅读(8) 评论(0) 推荐(0) 编辑

摘要: 依赖注入的基本使用1/Program.cs using Microsoft.Extensions.DependencyInjection; ServiceCollection services = new ServiceCollection(); // 瞬态服务 services.AddTransi 阅读全文
posted @ 2024-02-09 21:35 AmazingCookie 阅读(3) 评论(0) 推荐(0) 编辑

摘要: 依赖注入的基本使用1/Program.cs using Microsoft.Extensions.DependencyInjection; ServiceCollection services = new ServiceCollection(); // AddTransient的两种方式 // se 阅读全文
posted @ 2024-02-09 21:34 AmazingCookie 阅读(13) 评论(0) 推荐(0) 编辑

2024年2月6日 #

摘要: 代糖的分类 “代糖” 通常是指替代蔗糖、果糖、葡萄糖、麦芽糖、乳糖发挥甜味作用的甜味剂。 代糖能产生甜味,但是热量很低或是无热量,一般被分为人工代糖、天然代糖、糖醇和其他代糖。 常见的人工代糖包括甜蜜素、阿斯巴甜等; 常见的天然代糖包括甜菊糖苷、罗汉果糖等; 糖醇主要有赤藓糖醇、木糖醇、山梨糖醇等, 阅读全文
posted @ 2024-02-06 23:18 AmazingCookie 阅读(22) 评论(0) 推荐(0) 编辑

2024年1月31日 #

摘要: MIT许可证:只为作者保留版权,而无任何其他了限制。 它使人们几乎可以对您的项目进行任何操作,即时是制作和分发封闭源代码版本。 Babel,.NET Core和 Rails 使用MIT许可证¹。 BSD许可证:同样鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再发布 (作为开源或商业软件)。 阅读全文
posted @ 2024-01-31 19:32 AmazingCookie 阅读(21) 评论(0) 推荐(0) 编辑

摘要: RemoteDesktopConnection\src\Program.cs #define debug using System; using System.Text.RegularExpressions; namespace RDP { class Program { static void M 阅读全文
posted @ 2024-01-31 19:06 AmazingCookie 阅读(18) 评论(0) 推荐(0) 编辑

摘要: RemoteDesktopConnection\src\LogInfo.cs namespace RDP { class LogInfo { public string Ipaddress { get; set; } public string Username { get; set; } publ 阅读全文
posted @ 2024-01-31 18:38 AmazingCookie 阅读(13) 评论(0) 推荐(0) 编辑

摘要: PropertySupport\Person.cs public class Person { public string Name { get; set; } public string getPropertyName() { return PropertySupport.ExtractPrope 阅读全文
posted @ 2024-01-31 14:39 AmazingCookie 阅读(5) 评论(0) 推荐(0) 编辑

摘要: BindableBase.cs public abstract class BindableBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; // 调用方法 : publ 阅读全文
posted @ 2024-01-31 14:24 AmazingCookie 阅读(14) 评论(0) 推荐(0) 编辑

2024年1月30日 #

摘要: TightVNC连接命令 使用.vnc文件连接 tvnviewer.exe -optionsfile=C:\Users\AUO\Downloads\1.vnc 命令行明文传递密码连接 tvnviewer 192.168.1.168:5900 -password=123456 TightVNC命令 T 阅读全文
posted @ 2024-01-30 19:27 AmazingCookie 阅读(63) 评论(0) 推荐(0) 编辑

摘要: ![image](https://img2024.cnblogs.com/blog/1222814/202401/1222814-20240130151835676-1000593919.gif) 阅读全文
posted @ 2024-01-30 15:19 AmazingCookie 阅读(4) 评论(0) 推荐(1) 编辑

摘要: 数据绑定 SimpleBinding\MainWindow.xaml <Window x:Class="SimpleBinding.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: 阅读全文
posted @ 2024-01-30 15:15 AmazingCookie 阅读(5) 评论(0) 推荐(0) 编辑

摘要: event_learn\MyEvent.cs namespace MyEvent; public delegate void MyEventHandler(object sender, EventArgs e); // 定义一个自定义的事件接口,包含一个事件声明 public interface I 阅读全文
posted @ 2024-01-30 14:18 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑

摘要: event_learn\Program.cs // 定义一个派生自 EventArgs 的自定义类,用于封装数据 public class MyEventArgs : EventArgs { // 定义一个公共的字符串属性,用于存储和获取数据 public DateTime? EmitDate { 阅读全文
posted @ 2024-01-30 14:00 AmazingCookie 阅读(4) 评论(0) 推荐(0) 编辑