09 2020 档案

Autofac MagicOnion Grpc
摘要:1、定义Dto 和 Grpc协议 namespace MagicProtocal.Dto { public class Usr { public int Id { get; set; } public string Code { get; set; } public string Name { ge 阅读全文

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

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

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

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 阅读(241) 评论(0) 推荐(0)

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 阅读(256) 评论(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)

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

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

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 阅读(210) 评论(0) 推荐(0)

导航