lenmom

博客园 首页 新随笔 联系 订阅 管理

随笔分类 -  C#

上一页 1 2 3 4 下一页

摘要:一、组件 创建出来的对象需要从组件中来获取,组件的创建有如下4种(延续第一篇的Demo,仅仅变动所贴出的代码)方式: 1、类型创建RegisterType AutoFac能够通过反射检查一个类型,选择一个合适的构造函数,创造这个对象的实例。主要通过RegisterType<T>() 和 Regist 阅读全文
posted @ 2018-05-24 10:54 老董 阅读(23868) 评论(4) 推荐(7) 编辑

摘要:为了方面APP开发人员,服务端的接口都应当提供详尽的API说明。但每次有修改,既要维护代码,又要维护文档,一旦开发进度紧张,很容易导致代码与文档不一致。 Web API有一个Help Page插件,可以很方便的根据代码及注释自动生成相关API说明页面。 Help Page安装步骤及扩展(以VS201 阅读全文
posted @ 2018-05-24 10:11 老董 阅读(1736) 评论(0) 推荐(0) 编辑

摘要:HttpContext context; Request.Properties.TryGetValue("MS_HttpContext", out context); 阅读全文
posted @ 2018-05-16 14:04 老董 阅读(1265) 评论(0) 推荐(0) 编辑

摘要:实体定义: 数据库存储内容形式: 1. 删除内嵌字段的值: 如删除Attribute子集合: 2. 删除Attribute集合中Id等于6的内嵌文档 或者 或者 var filter = Builders<Person>.Filter.Where(x => x.Id == id); var upda 阅读全文
posted @ 2018-05-08 19:30 老董 阅读(5667) 评论(0) 推荐(0) 编辑

摘要:ASP.NET Web API is a great piece of technology. Writing Web API is so easy that many developers don’t take the time to structure their applications fo 阅读全文
posted @ 2018-04-28 10:39 老董 阅读(195) 评论(0) 推荐(0) 编辑

摘要:I have recently come across a comparison of fast JSON serializers in .NET, which shows that Jil JSON serializer is one of the fastest. Jil is created 阅读全文
posted @ 2018-04-28 10:14 老董 阅读(392) 评论(0) 推荐(0) 编辑

摘要:log4net Integration Module While there is no specific assembly for log4net support, you can easily inject log4net.ILog values using a very small custo 阅读全文
posted @ 2018-04-21 17:58 老董 阅读(447) 评论(0) 推荐(0) 编辑

摘要:While constructor parameter injection is the preferred method of passing values to a component being constructed, you can also use property or method 阅读全文
posted @ 2018-04-21 17:19 老董 阅读(179) 评论(0) 推荐(0) 编辑

摘要:在WebAPI中,请求主体(HttpContent)只能被读取一次,不被缓存,只能向前读取的流。 举例子说明: 1. 请求地址:/?id=123&name=bob 服务端方法: void Action(int id, string name) // 所有参数都是简单类型,因而都将来自url 2. 请 阅读全文
posted @ 2018-04-16 15:58 老董 阅读(205) 评论(0) 推荐(0) 编辑

摘要:最近事情比较多,有预研的,有目前正在研发的,都是很需要时间的工作,所以导致这周只写了两篇Orchard系列的文章,这边不能保证后期会很频繁的更新该系列,但我会写完这整个系列,包括后面会把正在研发的东西跟大家一起分享(架构、思想上的分享)。 今天我们来看一看Orchard中的Logging Compo 阅读全文
posted @ 2018-04-13 14:55 老董 阅读(230) 评论(0) 推荐(0) 编辑

摘要:Web APi之认证(Authentication)及授权(Authorization)【一】(十二) http://www.cnblogs.com/CreateMyself/p/4856133.html Web APi之认证(Authentication)两种实现方式【二】(十三) https:/ 阅读全文
posted @ 2018-04-12 18:14 老董 阅读(400) 评论(0) 推荐(0) 编辑

摘要:英语原文地址:http://www.asp.net/web-api/overview/security/authentication-and-authorization-in-aspnet-web-api 中文原文地址: https://www.cnblogs.com/youring2/archiv 阅读全文
posted @ 2018-04-12 16:56 老董 阅读(286) 评论(0) 推荐(0) 编辑

摘要:原文地址:http://www.cnblogs.com/fish-li/archive/2011/07/03/2096903.html#undefined Cookie虽然是个很简单的东西,但它又是WEB开发中一个很重要的客户端数据来源,而且它可以实现扩展性很好的会话状态, 所以我认为每个WEB开发 阅读全文
posted @ 2018-04-11 19:54 老董 阅读(680) 评论(0) 推荐(0) 编辑

摘要:A benefit of using ASP.NET Web API is that it can be consumed by any client with the capability of making HTTP calls and processing JSON data. The cli 阅读全文
posted @ 2018-04-11 19:07 老董 阅读(312) 评论(0) 推荐(0) 编辑

摘要:ASP.NET Web API, as we know now, is a framework that helps build Services over HTTP. Web API was introduced as a lightweight service framework keeping 阅读全文
posted @ 2018-04-11 19:03 老董 阅读(324) 评论(0) 推荐(0) 编辑

摘要:In a Web API application, I use Castle Windsor to supply services configured with PerWebRequest lifetime and everything works fine on IIS. However, wh 阅读全文
posted @ 2018-04-11 18:58 老董 阅读(226) 评论(0) 推荐(0) 编辑

摘要:阅读目录 开始 无处不在的HttpContext HttpContext.Current到底保存在哪里? HttpContext并非无处不在! 如何获取文件绝对路径? 异步调用中如何访问HttpContext? 安全地使用HttpContext.Current 阅读目录 开始 无处不在的HttpCo 阅读全文
posted @ 2018-04-11 15:14 老董 阅读(934) 评论(0) 推荐(0) 编辑

摘要:Having said that, here is a solution that you can use with the Unity container: Create some custom attributes for the different lifetime styles that y 阅读全文
posted @ 2018-03-20 17:13 老董 阅读(234) 评论(0) 推荐(0) 编辑

摘要:背景 使用Autofac进行依赖注入时,经常遇到的场景是在容器中进行类似如下代码的注入操作: 因为这种注入是统一进行的,随着项目规模的扩大和代码复杂度的增加,需要在注册的地方不断地增加新的类来注册类型,这样会使代码失去了开闭原则:对修改关闭,对扩展开放。 解决方案 1. 定义一个属性用于标识类的注入 阅读全文
posted @ 2018-03-20 15:15 老董 阅读(363) 评论(0) 推荐(0) 编辑

摘要:1. 通过Nuget安装System.Web.Http.Tracing. 2. 通过HttpConfiguration,注册SystemDiagnosticsTraceWriter 3. 运行,即可看到整个运行过程的信息日志信息,通过日志信息可以窥探WebApi的运行内核信息。 发送请求: 输出信息 阅读全文
posted @ 2018-03-20 10:58 老董 阅读(2223) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 下一页