随笔分类 -  ASP.NET

这里是.net的技术资源,这里见证我要在微软这条路上走下去,由浅入深。
摘要:引言 正则表达式(regular expression)就是用一个“字符串”来描述一个特征,然后去验证另一个“字符串”是否符合这个特征。比如 表达式“ab+” 描述的特征是“一个 'a' 和 任意个 'b' ”,那么 'ab', 'abb', 'abbbbbbbbbb' 都符合这个特征。 正则表达式 阅读全文
posted @ 2016-02-19 11:13 calochCN 阅读(366) 评论(0) 推荐(0)
摘要:领域服务的时候,用到MEF的注入有参构造函数的方法,your master was attracted,打算稍微深挖一下,这篇来对此知识点做个总结。 一、知识点回顾 MEF作为IOC的方式之一,它的主要作用是解耦,MEF加上面向接口编程,可以使得你的设计更加灵活。我们知道类的构造函数是可以重载的,我 阅读全文
posted @ 2016-01-28 14:14 calochCN 阅读(357) 评论(0) 推荐(0)
摘要:WebRequestHandler handler = new WebRequestHandler(); try { X509Certificate2 certificate = new X509Cer... 阅读全文
posted @ 2016-01-15 15:02 calochCN 阅读(190) 评论(0) 推荐(0)
摘要:背景 在平时工作中我偶尔会写一些脚本监控HTTP接口的健康状况,基本上都是发送HTTP GET或HTTP POST请求,然后检测响应内容。但一直用的是WebClient和HttpWebRequest,虽然用它们也能进行异步请求(可参考我分享的代码:C#异步GET的3个例子),但总感觉那样用起来不太... 阅读全文
posted @ 2016-01-14 13:40 calochCN 阅读(380) 评论(0) 推荐(0)
摘要:关于nuget,貌似使用nuget获取的package会在项目解决方案根目录下面将所有download下来的依赖包存储下来,所以这里的package会是最后所有的引用所在,既然不自己维护dll库的位置,那这个就需要了,引用的时候如果用绝对路径,还得试一试。 阅读全文
posted @ 2015-12-23 23:43 calochCN 阅读(108) 评论(0) 推荐(0)
摘要:快要过年了。要回家接受一些事实。人生在世,如此而已。 阅读全文
posted @ 2015-12-15 20:41 calochCN 阅读(123) 评论(0) 推荐(0)
摘要:https://msdn.microsoft.com/zh-cn/library/microsoft.visualbasic.vbcodeprovider%28v=vs.110%29.aspxreference to a compiler service. 阅读全文
posted @ 2015-12-13 15:32 calochCN 阅读(201) 评论(0) 推荐(0)
摘要:选择HttpHandler还是HttpModule? HttpHandler和HttpModule之间有什么差别 之所以有这个疑问,是因为在这二类对象中都可以访问Request, Response对象,都能处理请求。 我原以为在博客 用Asp.net写自己的服务框架 中做了那么多的演... 阅读全文
posted @ 2015-12-12 23:49 calochCN 阅读(377) 评论(0) 推荐(0)
摘要:dynamic:void Main(){ var b="2"; dynamic a="2"; if(a.GetType()==typeof(int))b+=a; if(a.GetType()==typeof(string))b+=a; Console.WriteLine (b); Console.W... 阅读全文
posted @ 2015-12-10 15:13 calochCN 阅读(121) 评论(0) 推荐(0)
摘要:var logger = LoggerResolver.Current.Logger; var dbContext = applicationContext.DatabaseContext; var helper = new DatabaseSchemaHelper(dbContext.Databa 阅读全文
posted @ 2015-12-07 13:59 calochCN 阅读(200) 评论(0) 推荐(0)
摘要:The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)solution: right click on re... 阅读全文
posted @ 2015-12-01 10:59 calochCN 阅读(419) 评论(0) 推荐(0)
摘要:1.use nuget to install unity.webapi 2.add configurations in application_start folder using Microsoft.Practices.Unity; using PatV2Tool.Bussiness.BLL; u 阅读全文
posted @ 2015-11-28 19:32 calochCN 阅读(329) 评论(0) 推荐(0)
摘要:1.add content negotiatorusing System;using System.Collections.Generic;using System.Linq;using System.Net.Http;using System.Net.Http.Formatting;using S... 阅读全文
posted @ 2015-11-28 19:28 calochCN 阅读(329) 评论(0) 推荐(0)
摘要:use ef power tools, as to .edmx file,right click at view, choose generate database from model, then copy the generated sql text, run the text in datab... 阅读全文
posted @ 2015-11-28 15:24 calochCN 阅读(231) 评论(0) 推荐(0)
摘要:web api写api接口时默认返回的是把你的对象序列化后以XML形式返回,那么怎样才能让其返回为json呢,下面为大家介绍几种不错的方法web api写api接口时默认返回的是把你的对象序列化后以XML形式返回,那么怎样才能让其返回为json呢,下面就介绍两种方法: 方法一:(改配置法) 找到G... 阅读全文
posted @ 2015-11-27 14:02 calochCN 阅读(575) 评论(0) 推荐(0)
摘要:System.Net.Http是微软推出的最新的HTTP应用程序的编程接口,微软称之为“现代化的HTTP编程接口”,主要提供如下内容:1.用户通过HTTP使用现代化的WebService的客户端组件;2.能够同时在客户端与服务端同时使用的HTTP组件(比如处理HTTP标头和消息),为客户端和服务端提... 阅读全文
posted @ 2015-11-27 13:57 calochCN 阅读(631) 评论(0) 推荐(0)
摘要:1.controllerusing System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;namespace TestMvc.Controllers{ pu... 阅读全文
posted @ 2015-11-27 13:21 calochCN 阅读(164) 评论(0) 推荐(0)
摘要:public override object operator + (object a,object b) { return this; } 阅读全文
posted @ 2015-11-23 13:48 calochCN 阅读(114) 评论(0) 推荐(0)
摘要://+ using System.Reflection; //+ using System.Reflection.Emit; static void Main(string[] args) { var dm = GetMethod(... 阅读全文
posted @ 2015-11-06 17:36 calochCN 阅读(399) 评论(0) 推荐(0)
摘要:System.Reflection.MethodInfo mInfo = typeof(TypeParse).GetMethod("Add", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Inst... 阅读全文
posted @ 2015-11-06 17:17 calochCN 阅读(319) 评论(0) 推荐(0)