上一页 1 2 3 4 5 6 7 8 ··· 18 下一页

2020年9月23日

netcore 依据注解自动注入

摘要: DbCtxt.ConnStr = Configuration.GetSection("ConnectionString").Value; // 根据类是否添加注解[IsService]来自动注入 var assm = new[] { typeof(Program).Assembly, typeof( 阅读全文

posted @ 2020-09-23 07:44 jonney_wang 阅读(609) 评论(0) 推荐(0)

2020年9月17日

NLog

摘要: public static class LogUtil { static LogUtil() { NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Path.GetDirector 阅读全文

posted @ 2020-09-17 17:51 jonney_wang 阅读(240) 评论(0) 推荐(0)

2020年9月16日

aspnetcore IExceptionFilter

摘要: public class GlobalExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext context) { context.Result = new ObjectResult(new { St 阅读全文

posted @ 2020-09-16 22:21 jonney_wang 阅读(250) 评论(0) 推荐(0)

WebApi IExceptionFilter

摘要: public class ExceptionFilter : System.Web.Http.Filters.IExceptionFilter { bool IFilter.AllowMultiple => true; Task IExceptionFilter.ExecuteExceptionFi 阅读全文

posted @ 2020-09-16 07:24 jonney_wang 阅读(248) 评论(0) 推荐(0)

2020年9月13日

MagicOnion Grpc ContractlessStandard

摘要: 前言: MessagePack 序列化默认是标准的 StandardResolver ,如果希望DTO模型不再添加 [MessagePackObject(true)] 这样的注解(这样更普遍一些),那么需要在 Server端和 Client 端都要设置一下序列化的 Resolver,把默认的标准Re 阅读全文

posted @ 2020-09-13 08:14 jonney_wang 阅读(281) 评论(0) 推荐(0)

2020年9月11日

Extend

摘要: public static class Extend { public static DateTime Local(this DateTime now) { return DateTime.Parse(now.ToString("yyyy-MM-dd HH:mm:ss")); } public st 阅读全文

posted @ 2020-09-11 22:15 jonney_wang 阅读(209) 评论(0) 推荐(0)

2020年8月16日

rabbitmq topic

摘要: var factory = new ConnectionFactory(); factory.HostName = "localhost"; factory.UserName = "admin"; factory.Password = "admin"; using (var connection = 阅读全文

posted @ 2020-08-16 11:28 jonney_wang 阅读(122) 评论(0) 推荐(0)

2020年7月8日

xps转pdf

摘要: 先安装PdfSharp 程序包。 class Converter { public static void Xps2Pdf(string xpsFileName, string pdfName) { if (!Directory.Exists(Path.GetDirectoryName(pdfNam 阅读全文

posted @ 2020-07-08 15:02 jonney_wang 阅读(552) 评论(0) 推荐(0)

SMTP发送电子邮件

摘要: class EmailHelper { /// <summary> /// SMTP 发送邮件 /// </summary> /// <param name="senderAddr">发件人邮箱</param> /// <param name="senderPwd">发件人邮箱密码</param> 阅读全文

posted @ 2020-07-08 14:59 jonney_wang 阅读(180) 评论(0) 推荐(0)

log4net配置

摘要: <?xml version="1.0" encoding="UTF-8"?> <log4net> <root> <level value="all" /> <appender-ref ref="LogFileAppenderByDate" /> </root> <appender name="Log 阅读全文

posted @ 2020-07-08 14:58 jonney_wang 阅读(104) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 18 下一页

导航