08 2013 档案

摘要:ASP.NET MVC4 程序发生异常时,通过拦截Action的异常,重写ActionFilterAttribute 的方法OnActionExecuted实现。具体实现代码如下: /// /// 拦截Action的异常 /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] public class ExceFilterAttribute : ActionFilterAttribute { public ov... 阅读全文
posted @ 2013-08-21 17:22 科睿思博 阅读(650) 评论(1) 推荐(0)
摘要:在ASP.NET MVC4 中继承ActionFilterAttribute 类,重写OnActionExecuting方法/// /// 权限拦截 /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] public class PermissionFilterAttribute : ActionFilterAttribute { /// /// 权限拦截 /// //... 阅读全文
posted @ 2013-08-21 16:38 科睿思博 阅读(1144) 评论(3) 推荐(0)
摘要:实现步骤:1. 实现IDependencyResolver接口并通过DependencyResolver.SetResolver告知MVC,将部分类型实例解析工作交由IoC容器来处理;using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using Microsoft.Practices.Unity;namespace MvcIocDemo.IoC{ public class UnityDependencyResolver : IDepen... 阅读全文
posted @ 2013-08-20 17:02 科睿思博 阅读(420) 评论(0) 推荐(0)
摘要:public static void BubbleSort(int[] data) { int temp=0; for(int i=0;idata[j]) { temp=data[j]; data[j]=data[j-1]; data[j-1]=temp; } } } } public static void BubbleSort(int[] data) { int temp=0; bool IsChange=true; for(int i=0;idata[j]) { IsChange=true; temp=data[... 阅读全文
posted @ 2013-08-15 10:26 科睿思博 阅读(190) 评论(0) 推荐(0)