摘要: 我们先来看一个简单的场景,例如我们的blog系统有一个Post的对象,Post对象有一个Tags属性和Categories属性,他们的类型分别是:Post.Tags : StateList<string> (BlogEngine.NET 中的一个List<T>的扩展类型)Post.Categories : StateList<Category>假如我们要使用UpdataModel方法来对我们Post过来的Form表单数据更新到我们的Post对象中,可能会有如下的代码:/// <summary>/// 将提交过来的新随笔表单内容保存到数据库/// 阅读全文
posted @ 2012-02-09 10:58 左轮death029 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 首先继承自FilterAttribute类同时实现IActionFilter接口,代码如下:/**//// <summary>/// 防盗链Filter./// </summary>public class AntiOutSiteLinkAttribute : ActionFilterAttribute, IActionFilter{ public AntiOutSiteLinkAttribute(FileType fileType) { this.FileType = fileType; } /**//// <summary> /// 请求的文件类型.(文 阅读全文
posted @ 2012-02-09 10:57 左轮death029 阅读(276) 评论(0) 推荐(0) 编辑