随笔分类 -  .NET 6配置

摘要:1.定义一个静态类HostBuilderExtend作为扩展 1 public static class HostBuilderExtend 2 { 3 public static void Register(this WebApplicationBuilder builder) 4 { 11 12 阅读全文
posted @ 2023-02-19 22:41 守护月亮的星星 阅读(153) 评论(0) 推荐(0)
摘要:1.在add-migration后添加‘-Context’指定上下文参数 add-migration -Context '指定上下文类名' '备注信息' 2.在更新数据库时同样需要指定 update-database -Context '指定上下文类' 阅读全文
posted @ 2023-02-19 22:35 守护月亮的星星 阅读(178) 评论(0) 推荐(0)
摘要:准备接口及实现类 public interface IHeadphone { } public interface IMicrophone { } public interface IPower { } public class Headphone : IHeadphone { public Hea 阅读全文
posted @ 2022-11-23 10:03 守护月亮的星星 阅读(145) 评论(0) 推荐(1)
摘要:1.Nuget 引入 NLog NLog.Web.AspNetCore NLog.Database(写入数据库使用) 2.创建nlog.config 注意数据库连接字符串需要配置TrustServerCertificate=True;不然会有认证问题 <?xml version="1.0" enco 阅读全文
posted @ 2022-11-22 08:38 守护月亮的星星 阅读(555) 评论(0) 推荐(0)
摘要:appsetting.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*", "ConnectionStrings" 阅读全文
posted @ 2022-10-10 11:16 守护月亮的星星 阅读(240) 评论(0) 推荐(0)