自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

转载 Setup Entity Framework Core in ASP.NET Core

1. Run following command to install required packages:Install-Package Microsoft.EntityFrameworkCore.SqlServer2. For database first approach, need to run below two commands to install required...

2017-07-21 16:04:00 164

转载 ASP.NET MVC 5 Controller Extensibility

Creating a Custom Controller FactoryCreate a custom controller factory by implementing IControllerFacotry interface and register it in Application_Start method of Global.asax file. ...

2017-06-13 15:28:00 224

转载 ASP.NET MVC 5 Filters

Filters are .NET attributes that add extra steps to the request processing pipeline. The MVC Framework supports five different types of filters. Each allows you to introduce logic at different po...

2017-06-12 16:55:00 168

转载 Entity Framework Notes

1. TransactionIn all versions of Entity Framework, whenever you execute SaveChanges() to insert, update or delete on the database the framework will wrap that operation in a transaction. This t...

2017-06-02 15:27:00 141

转载 ASP.NET MVC 5 Controllers and Actions

Creating a Controller with IControllerAll controller classes must implemet IController interface. public class BasicController : IController { public void Execute(RequestCo...

2017-05-13 11:36:00 129

转载 ASP.NET MVC 5 URL Routing

Convention-based RoutingCreating and Registering a Simple RouteApp_Start/RouteConfig.cs public class RouteConfig { public static void RegisterRoutes(RouteCollection route...

2017-05-10 22:40:00 113

转载 ASP.NET MVC 5 Model Validation

Explicitly Validating a Model [HttpPost] public ViewResult MakeBooking(Appointment appt) { if (string.IsNullOrEmpty(appt.ClientName)) { ...

2017-05-03 10:31:00 118

转载 ASP.NET MVC 5 Model Binding

Default Model BinderThe Order in Which the DefaultModelBinder Class Looks for Parameter Data:Request.Form - Values provided by the user in HTML form elementsRouteData.Values - The values ...

2017-05-02 11:57:00 107

转载 c# delegate

C# version 1.0 delegate// Declare delegate type PerformCalculatorpublic delegate int PerformCalculator(int x, int y);public class SampleClass{ private int Add(int x, int y) { ...

2017-04-29 16:30:00 89

转载 c# event

Event declaration and implementation: // Declare event arguement class public class SampleEventArgs { public SampleEventArgs(string s) { Text = s; } public stri...

2017-04-29 16:09:00 89

转载 Upgrade from .NET 4.0 to .NET 4.5 issue

There is a compatible issue found during upgrading from .net 4.0 to .net 4.5. The application crashed with following error:This exception was thrown because the generator for control 'System.Wi...

2017-03-21 10:03:00 149

转载 Failed to sign bin\Debug\app.publish\setup.exe. SignTool Error: No certificates were found that met ...

The error is related with *.pfx file that is used in ClickOnce based deployment. All ClickOnce apps must have their clickonce manifests digitally signed by a certificate.It's a security feature...

2017-03-20 10:50:00 362

转载 Angular中使用$http.jsonp发送跨站请求

Angular中使用$http.jsonp发送跨站请求的实践中,遇到了下面的一些问题:1. 不是所有返回json格式的url都支持jsonp,服务器端需要支持从url中读取返回函数并用它封装json数据。2.AngularJS v1.6.1中,url中不能包含callback这个参数,而是用jsonpCallbackParam来指定$http.jsonp('some/t...

2017-02-09 16:49:00 110

转载 Compress a folder using powershell

There are many ways to compress a folder using powershell:Method 1: UsingSystem.IO.Compression andSystem.IO.Compression.FileSystemAdd-Type -AssemblyName System.IO.CompressionAdd-Type -A...

2017-01-16 16:58:00 115

转载 beforeunload event

The beforeunload event is fired when the window, the document and its resources are about to be unloaded.目前该事件只有IE支持自定义消息,Chrome, Safari, Firefox都已不再支持(因为很多诈骗网站用此消息欺骗用户的原因)。可以用此事件来防止backspace...

2016-11-24 19:37:00 447

转载 WPF data binding

Binding这个类包含以下几个常用的属性:ElementName: Gets or sets the name of the elements to use as the binding source object. [Default is null]Source:Gets or sets the object to use as the binding source....

2016-11-16 18:04:00 78

转载 Http Cookie里面HttpOnly和Secure标记

SecureThe secure option is a flag that can be set by the application server when sending a new cookie to the user within a HTTP Response. The purpose of the secure flag is to prevent cookie fro...

2016-11-02 13:19:00 563

转载 Javascript function return object, return this和没有return的差别

Function在javascript里面可以实例化,也可以直接调用。作为直接调用对象时,它会执行这个function并得到相应的返回值。function makeGamePlayer(name,totalScore,gamesPlayed) { var obj = { name: name, totalScore: totalS...

2016-10-25 16:39:00 248

转载 Javascript创建空对象和空数组的几个方法和差别

以下是三种创建空对象的方法:var emptyObj1 = {};var emptyObj2 = new Object();var emptyObj2 = Object.create(Object.prototype);他们对Javascript来说是一样的,新创建的三个对象会继承object所有的属性和方法,所以emptyObj1.toString等于Objec...

2016-10-19 23:07:00 853

转载 Object.prototype.toString vs typeof

var start = new Date(); for(var i = 0; i < 100000000; i++){ Object.prototype.toString.call(1)}; var end = new Date(); console.log(end-start);执行时间:33526var start = new Date(); for(var...

2016-09-01 10:48:00 81

转载 Object.prototype.toString.call("abc")和"abc".toString()的值不一样

Object.prototype.toString.call("abc")返回[object String], 因为这个toString方法并不知道传入参数的类型,所以会返回一个通用的结果,即传入参数的类型。"abc".toString()返回abc,"abc"已经是String类型了,String.prototype.toString覆盖了默认的Object.prototype.t...

2016-08-31 18:10:00 110

转载 Javascript值引用和对象引用

Avariablecan hold one of two types of values:primitive values and reference values.Primitive valuesare data that are stored on thestack.Primitive valueis stored directly in the locati...

2016-08-30 14:05:00 134

转载 Javascript自执行函数 (Immediately-Invoked Function Expression)

1. Javascript编译器在遇到function这个关键字时,默认认为它是function声明,而不是表达式。2. 在已声明的function后面加括号,即可调用它。比如,function foo(){console.log('hello javascript.')}foo();3. 括号里面允许javascript表达式,(function(){console.l...

2016-08-29 17:04:00 286

转载 IValidatableObject实现model自定义验证

namespace:System.ComponentModel.DataAnnotationsAssembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)Example: public class IACUCRenewMembershi...

2016-07-14 15:15:00 234

转载 c# language note

Static ClassA static class cannot be instantiated. In other words, you cannot use the newkeyword to create a variable of the class type.The following list provides the main features of a sta...

2016-05-08 20:42:00 129

转载 通过Global.asax文件里面的Session_End事件记录用户退出 (or session timeout)

Session.Abandon()和timeout会触发Global.asax的Session_End事件。可以通过这个事件来记录用户退出或者session timeout,这样每个用户都会有一条登陆和退出记录。退出登陆调用方法:public void PerformLogout(){ HttpContext.Current.Session["PerformLo...

2016-04-26 17:14:00 474

转载 网站性能优化之开启服务器端http压缩

公司的一个项目由于管理和开发方面的一些问题,导致开发完成之后,一个js文件变的很大,minimize之后还有700kb, 影响了网站的性能,特别是在网速慢的时候,加载一个页面居然要2分钟。招来了一大堆的客户投诉。。。解决这个问题最理想的办法是分解这个超大js文件,只加载所需的javascript。但是由于最初的开发人员都已经不再了,这个分解任务风险系数太高,不能轻易尝试(客户要求很高...

2016-04-08 22:09:00 174

转载 AngularJS中的$watch(),$digest()和$apply()

AngularJS $scope里面的$watch(),$digest()和$apply()是AngularJS的核心函数,学习AngularJS必须理解这几个函数。在绑定$scope中的变量到view的时候,AngularJS自动在内部创建一个"Watch"。"Watch"用于监听AngularJS scope中变量的改变。可以通过调用$scope.$watch()这个方法来创建"...

2016-04-03 19:46:00 94

转载 浅谈asp.net session time out问题

公司已经在production的一个project最近有client反馈说登陆进网站之后,开着一整天没动它,之后还是可以继续操作。client那边的IT部门要求我们提供session time out方面的设置,以及工作原理。自认为做了5年的web application,clients这个基本的要求可以很快搞定。1. 检查Web.config文件里面的timeout设置在sys...

2014-11-20 17:03:00 227

转载 .NET中把DataTable转换成JSON的总结

最近在做公司的一个project,其中有一部分,要求浏览器端通过jquery ajax调用服务器端返回json格式的多条数据。网上搜索了一下,找到下面两个方法在.NET中生成json。方法一:.NET Framework 3.0及更早的版本:public static string GetJSONString(DataTable Dt){ string[] St...

2014-07-05 14:46:00 236

转载 Javascript的事件委托和事件处理

随着Ajax和RIA越来越成为主流,Javascript对事件(Event)的支持也得到了越来越多的关注。像雅虎这样的公司正在突破RIA的极限,让web应用程序在浏览器中更有效的运行,就像桌面应用程序一样。雅虎的邮箱应用就是一个很好的例子。雅虎的一些工程师给我们展示了提高Javascript应用程序性能的技术。其中有提到强大的事件处理架构。提高性能的要旨就是用事件委托(Event D...

2014-06-25 17:26:00 65

转载 为什么要设置Javascript对象prototype的constructor

最近读了一篇关于Javascript面向对象编程的文章,里面介绍了Javascript中的类,对象,属性,方法,构造函数,继承,封装,抽象和多态性。读完之后感觉受益匪浅,对Javascript有了进一步的认识。文章的地址在这里。在讲到继承的时候,文章里面用了如下的例子// define the Person Classfunction Person() {}Per...

2014-06-19 17:24:00 86

转载 JavaScript中的执行上下文和堆栈

什么是执行上下文(execution context)和堆栈(stack)?在本文中,我会深入分析Javascript中最基本的一个部分,执行上下文。读完本文,你会明白解析器是怎么去解析的,为什么有些函数和变量在没有申明之前就可以被调用。什么是执行上下文?Javascript代码在执行过程中,所处的执行环境是很重要的,这些执行环境可以分为以下几类:全局代码(Globa...

2014-06-11 22:59:00 55

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除