2019年8月9日

Filter 过滤器

摘要: 1.Action前和Action后 IActionFilter(还须要继承特性) 2. 异常处理的Filter ExceptionFilterAttribute 3.请求页面前,没有进控制器 IResourceFilter 4.返回结果 阅读全文

posted @ 2019-08-09 17:58 一只狐狸。 阅读(252) 评论(0) 推荐(0) 编辑

添加Filter 并控制它的执行顺序

摘要: 1都是加在方法或者控制器头上 [TypeFilter(typeof(CustomControllerActionFilterAttribute),Order =-1)] 2.都是加在方法或者控制器头上 [ServiceFilter(typeof(CustomActionFilterAttribute 阅读全文

posted @ 2019-08-09 17:43 一只狐狸。 阅读(384) 评论(0) 推荐(0) 编辑

在startup 添加数据库链接字符串

摘要: services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("SqlServerConnection"))); 阅读全文

posted @ 2019-08-09 17:13 一只狐狸。 阅读(366) 评论(0) 推荐(0) 编辑

添加 Startup 中间件

摘要: 1. app.UseMiddleware<ElevenStopMiddleware>(); 2. public class ElevenStopMiddleware { private readonly RequestDelegate _next; public ElevenStopMiddlewa 阅读全文

posted @ 2019-08-09 17:09 一只狐狸。 阅读(231) 评论(0) 推荐(0) 编辑

log4net.config配置内容

摘要: <?xml version="1.0" encoding="utf-8" ?><log4net> <!-- Debug 将日志以回滚文件的形式写到文件中 --> <appender name="RollingFileDebug" type="log4net.Appender.RollingFileA 阅读全文

posted @ 2019-08-09 16:42 一只狐狸。 阅读(2295) 评论(0) 推荐(0) 编辑

Program 替换自带容器

摘要: 1. nuget添加 Autofac 2.Autofac.Extensions.DependencyInjection 3.Autofac.Extras.IocManager.DynamicProxy 1.替换自带容器 .UseServiceProviderFactory(new AutofacSe 阅读全文

posted @ 2019-08-09 16:27 一只狐狸。 阅读(377) 评论(0) 推荐(0) 编辑

EF CORE执行原生SQL

摘要: 1.接口 IQueryable<T> ExcuteQuery<T>(string sql,params object[] parameters) where T : class; 2.接口实现 public IQueryable<T> ExcuteQuery<T>(string sql,params 阅读全文

posted @ 2019-08-09 16:20 一只狐狸。 阅读(4143) 评论(1) 推荐(3) 编辑

导航