通过写后台权限领悟到的东西
1.Tagbuilder 本身引用的是system.web.mvc但是在mvc3种如果单纯的引用system.web.mvc还是不够的,还需要应用system.web.WebPages
2.linq中的let的使用方法:
let的作用是产生一个用于存储查询表达式中的子表达式查询结果的范围变量
eg:
var actions = _adminAcionService.GetAdminActionsWithRoles();
var role = _adminRoleService.GetAdminRole(id);
var sortedActions = from i in actions
orderby i.OrderId
where !i.ParentId.HasValue
let s = (from j in actions
where j.ParentId.HasValue && j.ParentId.Value == i.ActionId
select new AdminActionWithChecked() { AdminAction = j, IsChecked = j.Roles.Contains(role) })
select new EditRolePermissionComplexType() { ParentAction = i, SubActions = s.ToList() };
return View(new EditRolePermissionViewModel()
{
ComplexAction = sortedActions.ToList(),
Role = role
});
让我看了好一阵的代码,觉得很精辟
3.数据表的设计