随笔分类 -  net core

摘要:dotnetcore的单元测试目前支持的比较好的是xunit,首先通过nuget添加组件dotnet-test-xunit 和 xunit。如果有依赖注入可在构造方法中,相当于Nunit中的[Setup]。例如: 编译后,回出现在vs的测试资源管理器中。 关于两个实体的值的比较,可通过引入“Flue 阅读全文
posted @ 2016-11-24 15:22 Ryan chen 阅读(2655) 评论(2) 推荐(0)
摘要:首先添加"SwaggerGenerator": "1.1.0","SwaggerUi": "1.1.0" 需要注意的是这两个组件是我对Swashbuckle的重新封装,因为当前版本对泛型会报错。 在ConfigureServices 中添加: 在config方法中添加: 在controller中需要 阅读全文
posted @ 2016-11-23 17:56 Ryan chen 阅读(384) 评论(0) 推荐(1)
摘要:Jwt 已经成为跨平台身份验证通用方案,如不了解请关注:https://jwt.io/。 为了和微软其他验证模块有个比较好的衔接,项目中采用了微软开发的jwt组件: System.IdentityModel.Tokens.Jwt。首先安装:Install-Package System.Identit 阅读全文
posted @ 2016-11-23 16:46 Ryan chen 阅读(2472) 评论(0) 推荐(1)
摘要:Tag Helpers The EnvironmentTagHelper can be used to include different scripts in your views (for example, raw or minified) based on the runtime enviro 阅读全文
posted @ 2016-10-26 16:17 Ryan chen 阅读(209) 评论(0) 推荐(0)
摘要:startup startup asp.net core 的入口,在构造函数中完成环境参数的配置。 ConfigureServices 方法,参数是IServiceCollection,是配置依赖注入的。需要注意的是此方法是在configure之前运行的。 在startup中的几个类: middle 阅读全文
posted @ 2016-10-26 13:51 Ryan chen 阅读(648) 评论(0) 推荐(0)