3.自定义路由约束 什么叫自定义路由约束呢?假如路由格式为archive/{year}/{month}/{day},其中year,month,day是有约束条件的,必须是数字,而且有一定范围. 这时候,我们就可以设置约束类,进行自定义路由约束了. 第一步: 我们先添加年份限制类 YearRouteConstraint.请看代码: using System; using System.Collections.Generic; using System.Linq; using System.Web;…
终于有时间整理一下asp.net mvc 和 entity framework 方面的素材了. 闲话少说,步入正题: 下面是model层的管理员信息表,也是大伙比较常用到的,看看下面的代码大伙应该不会陌生, 在此Model上我们用到了asp.net mvc的数据注解和验证,entity framework对数据库的映射 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi…