随笔分类 - .NET 6配置
摘要:1.定义一个静态类HostBuilderExtend作为扩展 1 public static class HostBuilderExtend 2 { 3 public static void Register(this WebApplicationBuilder builder) 4 { 11 12
阅读全文
摘要:1.在add-migration后添加‘-Context’指定上下文参数 add-migration -Context '指定上下文类名' '备注信息' 2.在更新数据库时同样需要指定 update-database -Context '指定上下文类'
阅读全文
摘要:准备接口及实现类 public interface IHeadphone { } public interface IMicrophone { } public interface IPower { } public class Headphone : IHeadphone { public Hea
阅读全文
摘要:1.Nuget 引入 NLog NLog.Web.AspNetCore NLog.Database(写入数据库使用) 2.创建nlog.config 注意数据库连接字符串需要配置TrustServerCertificate=True;不然会有认证问题 <?xml version="1.0" enco
阅读全文
摘要:appsetting.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "ConnectionStrings"
阅读全文