摘要: 关于ActionNameSelectorAttribute 和 ActionMethodSelectorAttribute的区别,请参考http://www.cnblogs.com/P_Chou/archive/2010/12/01/details-asp-net-mvc-07.html区分 [Ht... 阅读全文
posted @ 2013-01-16 11:45 不夜橙 阅读(2262) 评论(0) 推荐(1) 编辑
摘要: 学习MVC有一段时间了。感叹于MVC的高扩展性。这里总结一些MVC常用扩展。就先从最常用的AjaxHelper&HTMLHelper开始记录。一个最简单的例子。通过扩展方法扩展HTMLHelperpublic static string Label(this HtmlHelper helper, string name, string value){ return string.Format("<label for='{0}'>{1}</label><br />", name, value);}调用Html.Lab 阅读全文
posted @ 2013-01-16 10:14 不夜橙 阅读(3571) 评论(2) 推荐(0) 编辑
摘要: 1.官网的例子有一些问题。自己学习总结下并且重新打包一个版本供学习。 1.AttributedInterfaceInterceptionFixture [TestFixture] public class AttributedInterfaceInterceptionFixture { [Intercept(typeof(AddOneIntercept... 阅读全文
posted @ 2013-01-10 22:11 不夜橙 阅读(8567) 评论(6) 推荐(4) 编辑
摘要: MVC对模型验证提供了良好的支持。脱离了MVC框架又如何实现验证。做一下总结。1.基于MVC DataAnnotationshttp://www.cnblogs.com/hjf1223/archive/2010/11/07/independent-dataannotation-validation.html2. FluentValidation废话不多说,FluentValidation和Autofac整合首先是Model和Validatorpublic static IContainer container; [ClassInitialize()] publi... 阅读全文
posted @ 2013-01-05 21:27 不夜橙 阅读(1779) 评论(3) 推荐(0) 编辑
摘要: AutoMapper的基本使用请参考 :http://www.cnblogs.com/ljzforever/archive/2011/12/29/2305500.html 学习一下Nop是如何配置和集成AutoMapper的。 IStartupTask.cs namespace Nop.Core.Infrastructure{ public interface ... 阅读全文
posted @ 2012-09-27 22:37 不夜橙 阅读(2036) 评论(0) 推荐(0) 编辑
摘要: 1. 映射路由 大型MVC项目为了扩展性,可维护性不能向一般项目在Global中RegisterRoutes的方法里面映射路由。这里学习一下Nop是如何做的。 Global.cs . 通过IOC容器取得IRoutePublisher实例 public static void RegisterRoutes(RouteCollection routes) { ... 阅读全文
posted @ 2012-09-27 21:16 不夜橙 阅读(1959) 评论(1) 推荐(1) 编辑
摘要: 不知道大家是如何查找反射程序集中的类型。Nop封装了一个不错的实现。接口ITypeFinder/// <summary> /// Classes implementing this interface provide information about types /// to various services in the Nop engine. /// </summary> public interface ITypeFinder { IList<Assembly> GetAssemblies(); IEnumerable<Typ... 阅读全文
posted @ 2012-09-24 22:38 不夜橙 阅读(1789) 评论(2) 推荐(0) 编辑
摘要: 1.Nop提供了完整的FakeHttpContext实现,如图 1.FakeHttpContext的作用。 控制器进行单元测试时模拟web上下文环境,还有一些其他对HttpContext有依赖的组件也可以使用Fake从而进行组件的单元测试。 2.例举Nop中使用到FakeHttpContext的地方 (1).NopEngine(初始化NopEngine时,是web... 阅读全文
posted @ 2012-09-23 23:55 不夜橙 阅读(1271) 评论(0) 推荐(0) 编辑
摘要: 不知道大家是如何查找反射程序集中的类型。Nop封装了一个不错的实现。接口ITypeFinder/// <summary> /// Classes implementing this interface provide information about types /// to various services in the Nop engine. /// </summary> public interface ITypeFinder { IList<Assembly> GetAssemblies(); IEnumerable<Typ... 阅读全文
posted @ 2012-09-23 13:08 不夜橙 阅读(492) 评论(0) 推荐(0) 编辑
摘要: 在查找资料的过程中。原来园子里面已经有过分析了。nopCommerce架构分析系列(二)数据Cache。 接下来是一些学习补充。 1.Nop中没有System.Web.Caching.Cache的实现。原因暂不明。先自己实现一个吧 using System;using System.Collections.Generic;using System.Web;using Syst... 阅读全文
posted @ 2012-09-22 21:51 不夜橙 阅读(4847) 评论(0) 推荐(2) 编辑