下载连接
Pv3-Codeplex Pv4之间的差异:
ViewPage
ViewPage类
增加了InitHelpers方法
Controller
Controller类
新实现了IAuthorizationFilter/IExceptionFilter接口
添加了 public ITempDataProvider TempDataProvider { get; set; } 属性
ControllerActionInvoker类
新增加了四个方法:
FilterInfo GetFiltersForActionMethod(MethodInfo methodInfo);
ResultExecutedContext InvokeActionResultWithFilters(ActionResult actionResult, IList<IResultFilter>
filters);
AuthorizationContext InvokeAuthorizationFilters(MethodInfo methodInfo, IList<IAuthorizationFilter>
filters);
ExceptionContext InvokeExceptionFilters(Exception exception, IList<IExceptionFilter> filters);
删除了原有的:
IList<IActionFilter> GetActionFiltersForMember(MemberInfo memberInfo);
IList<IActionFilter> GetAllActionFilters(MethodInfo methodInfo);
ResultExecutedContext InvokeActionResultWithFilters(ActionResult actionResult, IList<IActionFilter>
filters);
ControllerBuilder 类
增加了属性public HashSet<String> DefaultNamespaces { get; }
ExceptionContext类
这是一个新增加的类,我想,可以用来输出美化的异常处理,呵呵
属性编程与Filter中
IActionFilter接口
删除了以下两个事件
void OnResultExecuted(ResultExecutedContext filterContext);
void OnResultExecuting(ResultExecutingContext filterContext);
ActionExecutedContext类的构造函数改为
ActionExecutedContext(ControllerContext controllerContext, MethodInfo actionMethod, Boolean canceled, Exception
exception)
增加了public Boolean Canceled { get; }只读属性
ActionFilterAttribute 类
由继承于Attribute 改为继承于FilterAttribute,另外增加实现 IResultFilter接口
删除了 Order 属性
另外新增加了几个类,有关用Action的Filter
对于Helper中
AjaxExtensions静态类
是新增加的,代码如下:
Mailto方法都被删除了
AjaxHelper类
这个算是改动最大添加了一些比较有用的实现
如
TempDataDictionary 类
设置为可以序列化
添加了Load和Save方法,并给了一个可以反序列化初始化的构造函数
ViewDataDictionary类
增加了个public Object Eval(String expression); 方法
MemberShip
对于微软自己的角色控制,有2个类被添加
MVC的缓存
public static class ButtonBuilder; // removed
public static class ButtonsAndLinkExtensions; // removed
public class ComponentController; // removed
public static class ImageBuilder; // removed
public static class ImageExtensions; // removed
public static class ViewExtensions; // removed
Pv3-Codeplex Pv4之间的差异:
ViewPage
ViewPage类
增加了InitHelpers方法
Controller
Controller类
新实现了IAuthorizationFilter/IExceptionFilter接口
添加了 public ITempDataProvider TempDataProvider { get; set; } 属性
ControllerActionInvoker类
新增加了四个方法:
FilterInfo GetFiltersForActionMethod(MethodInfo methodInfo);
ResultExecutedContext InvokeActionResultWithFilters(ActionResult actionResult, IList<IResultFilter>
filters);
AuthorizationContext InvokeAuthorizationFilters(MethodInfo methodInfo, IList<IAuthorizationFilter>
filters);
ExceptionContext InvokeExceptionFilters(Exception exception, IList<IExceptionFilter> filters);
删除了原有的:
IList<IActionFilter> GetActionFiltersForMember(MemberInfo memberInfo);
IList<IActionFilter> GetAllActionFilters(MethodInfo methodInfo);
ResultExecutedContext InvokeActionResultWithFilters(ActionResult actionResult, IList<IActionFilter>
filters);
ControllerBuilder 类
增加了属性public HashSet<String> DefaultNamespaces { get; }
ExceptionContext类
这是一个新增加的类,我想,可以用来输出美化的异常处理,呵呵
public
class
ExceptionContext : ControllerContext
{
public ExceptionContext(ControllerContext controllerContext, Exception exception);
public ActionResult Result { get; set; }
public Boolean ExceptionHandled { get; set; }
public Exception Exception { get; }
}
public ExceptionContext(ControllerContext controllerContext, Exception exception);
public ActionResult Result { get; set; }
public Boolean ExceptionHandled { get; set; }
public Exception Exception { get; }
}
属性编程与Filter中
IActionFilter接口
删除了以下两个事件
void OnResultExecuted(ResultExecutedContext filterContext);
void OnResultExecuting(ResultExecutingContext filterContext);
ActionExecutedContext类的构造函数改为
ActionExecutedContext(ControllerContext controllerContext, MethodInfo actionMethod, Boolean canceled, Exception
exception)
增加了public Boolean Canceled { get; }只读属性
ActionFilterAttribute 类
由继承于Attribute 改为继承于FilterAttribute,另外增加实现 IResultFilter接口
删除了 Order 属性
另外新增加了几个类,有关用Action的Filter
public
abstract
class
FilterAttribute : Attribute
{
protected FilterAttribute();
public Int32 Order { get; set; }
}
public class FilterInfo {
public FilterInfo();
public IList<IActionFilter> ActionFilters { get; set; }
public IList<IAuthorizationFilter> AuthorizationFilters { get; set; }
public IList<IExceptionFilter> ExceptionFilters { get; set; }
public IList<IResultFilter> ResultFilters { get; set; }
}
public sealed class HandleErrorAttribute : FilterAttribute, IExceptionFilter {
public HandleErrorAttribute();
public String View { get; set; }
public Type ExceptionType { get; set; }
}
public class HandleErrorInfo {
public HandleErrorInfo(Exception exception, String controller, String action);
public Exception Exception { get; }
public String Action { get; }
public String Controller { get; }
}
public class HttpUnauthorizedResult : ActionResult {
public HttpUnauthorizedResult();
}
还有一些我看来比较有用的类
protected FilterAttribute();
public Int32 Order { get; set; }
}
public class FilterInfo {
public FilterInfo();
public IList<IActionFilter> ActionFilters { get; set; }
public IList<IAuthorizationFilter> AuthorizationFilters { get; set; }
public IList<IExceptionFilter> ExceptionFilters { get; set; }
public IList<IResultFilter> ResultFilters { get; set; }
}
public sealed class HandleErrorAttribute : FilterAttribute, IExceptionFilter {
public HandleErrorAttribute();
public String View { get; set; }
public Type ExceptionType { get; set; }
}
public class HandleErrorInfo {
public HandleErrorInfo(Exception exception, String controller, String action);
public Exception Exception { get; }
public String Action { get; }
public String Controller { get; }
}
public class HttpUnauthorizedResult : ActionResult {
public HttpUnauthorizedResult();
}
public
interface
IAuthorizationFilter
{ //用来获取用户信息的FIlter接口
void OnAuthorization(AuthorizationContext filterContext);
}
public interface IExceptionFilter { //用来获取异常的FIlter接口
void OnException(ExceptionContext filterContext);
}
public enum InsertionMode { //感觉有点像触发器的感觉 ,这个Enum所标志的那个类一定很好用呵呵
Replace,
InsertBefore,
InsertAfter
}
public interface IResultFilter { //这个应该是新的Filter接口
void OnResultExecuted(ResultExecutedContext filterContext);
void OnResultExecuting(ResultExecutingContext filterContext);
}
public interface ITempDataProvider {
TempDataDictionary LoadTempData();
void SaveTempData(TempDataDictionary tempDataDictionary);
}
void OnAuthorization(AuthorizationContext filterContext);
}
public interface IExceptionFilter { //用来获取异常的FIlter接口
void OnException(ExceptionContext filterContext);
}
public enum InsertionMode { //感觉有点像触发器的感觉 ,这个Enum所标志的那个类一定很好用呵呵
Replace,
InsertBefore,
InsertAfter
}
public interface IResultFilter { //这个应该是新的Filter接口
void OnResultExecuted(ResultExecutedContext filterContext);
void OnResultExecuting(ResultExecutingContext filterContext);
}
public interface ITempDataProvider {
TempDataDictionary LoadTempData();
void SaveTempData(TempDataDictionary tempDataDictionary);
}
对于Helper中
AjaxExtensions静态类
是新增加的,代码如下:
public
static
class
AjaxExtensions {
public static Boolean IsMvcAjaxRequest(HttpRequestBase request);
}
LinkExtensions类
public static Boolean IsMvcAjaxRequest(HttpRequestBase request);
}
Mailto方法都被删除了
AjaxHelper类
这个算是改动最大添加了一些比较有用的实现
public
class
AjaxHelper
{
public String ActionLink(String linkText, String actionName, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, Object values, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, RouteValueDictionary values,
AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, Object values, AjaxOptions ajaxOptions, Object
htmlAttributes);
public String ActionLink(String linkText, String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions,
IDictionary<String,Object> htmlAttributes);
public String ActionLink(String linkText, String actionName, String controllerName, Object values, AjaxOptions
ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, RouteValueDictionary values,
AjaxOptions ajaxOptions, IDictionary<String,Object> htmlAttributes);
public String ActionLink(String linkText, String actionName, String controllerName, Object values, AjaxOptions
ajaxOptions, Object htmlAttributes);
public IDisposable Form(String actionName, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, Object values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, Object values, AjaxOptions ajaxOptions, Object htmlAttributes);
public IDisposable Form(String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions,
IDictionary<String,Object> htmlAttributes);
public IDisposable Form(String actionName, String controllerName, Object values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, Object values, AjaxOptions ajaxOptions, Object
htmlAttributes);
public IDisposable Form(String actionName, String controllerName, RouteValueDictionary valuesDictionary, AjaxOptions
ajaxOptions, IDictionary<String,Object> htmlAttributes);
}
另外因此而增加了一些对AjaxHelper辅助的类
public String ActionLink(String linkText, String actionName, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, Object values, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, RouteValueDictionary values,
AjaxOptions ajaxOptions);
public String ActionLink(String linkText, String actionName, Object values, AjaxOptions ajaxOptions, Object
htmlAttributes);
public String ActionLink(String linkText, String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions,
IDictionary<String,Object> htmlAttributes);
public String ActionLink(String linkText, String actionName, String controllerName, Object values, AjaxOptions
ajaxOptions);
public String ActionLink(String linkText, String actionName, String controllerName, RouteValueDictionary values,
AjaxOptions ajaxOptions, IDictionary<String,Object> htmlAttributes);
public String ActionLink(String linkText, String actionName, String controllerName, Object values, AjaxOptions
ajaxOptions, Object htmlAttributes);
public IDisposable Form(String actionName, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, Object values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, RouteValueDictionary values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, Object values, AjaxOptions ajaxOptions, Object htmlAttributes);
public IDisposable Form(String actionName, RouteValueDictionary values, AjaxOptions ajaxOptions,
IDictionary<String,Object> htmlAttributes);
public IDisposable Form(String actionName, String controllerName, Object values, AjaxOptions ajaxOptions);
public IDisposable Form(String actionName, String controllerName, Object values, AjaxOptions ajaxOptions, Object
htmlAttributes);
public IDisposable Form(String actionName, String controllerName, RouteValueDictionary valuesDictionary, AjaxOptions
ajaxOptions, IDictionary<String,Object> htmlAttributes);
}
如
public
class
AjaxOptions
{
public AjaxOptions();
public InsertionMode InsertionMode { get; set; }
public String OnBegin { get; set; }
public String OnFailure { get; set; }
public String OnSuccess { get; set; }
public String UpdateTargetId { get; set; }
}
存储系统
public AjaxOptions();
public InsertionMode InsertionMode { get; set; }
public String OnBegin { get; set; }
public String OnFailure { get; set; }
public String OnSuccess { get; set; }
public String UpdateTargetId { get; set; }
}
TempDataDictionary 类
设置为可以序列化
添加了Load和Save方法,并给了一个可以反序列化初始化的构造函数
ViewDataDictionary类
增加了个public Object Eval(String expression); 方法
MemberShip
对于微软自己的角色控制,有2个类被添加
public
class
AuthorizationContext : ControllerContext
{ //看来是用来在Membership得到Action信息
public AuthorizationContext(ControllerContext controllerContext, MethodInfo actionMethod);
public ActionResult Result { get; set; }
public Boolean Cancel { get; set; }
public MethodInfo ActionMethod { get; }
}
public sealed class AuthorizeAttribute : FilterAttribute, IAuthorizationFilter { //这个是在Controller中获取用户信息的应该是的,呵呵
public AuthorizeAttribute();
public String Roles { get; set; }
public String Users { get; set; }
}
新功能
public AuthorizationContext(ControllerContext controllerContext, MethodInfo actionMethod);
public ActionResult Result { get; set; }
public Boolean Cancel { get; set; }
public MethodInfo ActionMethod { get; }
}
public sealed class AuthorizeAttribute : FilterAttribute, IAuthorizationFilter { //这个是在Controller中获取用户信息的应该是的,呵呵
public AuthorizeAttribute();
public String Roles { get; set; }
public String Users { get; set; }
}
MVC的缓存
public
class
MvcHttpHandler : UrlRoutingHandler, IRequiresSessionState
{
public MvcHttpHandler();
}
public sealed class OutputCacheAttribute : ActionFilterAttribute, IActionFilter, IResultFilter { //明显就是一个缓存的Filter呵呵
public OutputCacheAttribute();
public Boolean NoStore { get; set; }
public Int32 Duration { get; set; }
public OutputCacheLocation Location { get; set; }
public String CacheProfile { get; set; }
public String VaryByContentEncoding { get; set; }
public String VaryByCustom { get; set; }
public String VaryByHeader { get; set; }
public String VaryByParam { get; set; }
}
删除 的类
public MvcHttpHandler();
}
public sealed class OutputCacheAttribute : ActionFilterAttribute, IActionFilter, IResultFilter { //明显就是一个缓存的Filter呵呵
public OutputCacheAttribute();
public Boolean NoStore { get; set; }
public Int32 Duration { get; set; }
public OutputCacheLocation Location { get; set; }
public String CacheProfile { get; set; }
public String VaryByContentEncoding { get; set; }
public String VaryByCustom { get; set; }
public String VaryByHeader { get; set; }
public String VaryByParam { get; set; }
}
public static class ButtonBuilder; // removed
public static class ButtonsAndLinkExtensions; // removed
public class ComponentController; // removed
public static class ImageBuilder; // removed
public static class ImageExtensions; // removed
public static class ViewExtensions; // removed