扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
/// <summary> /// DBModel.Table /// </summary> [Serializable] [NClay.Data.Mappings.TableMapper("Category")] public partial class Category { public Category () { // // TODO: 在此处添加构造函数逻辑 // } private string mCategoryID; /// <summary> /// varchar /// </summary> [NClay.Data.Mappings.PrimaryKey("CategoryID")] public string CategoryID { get { return mCategoryID; } set { mCategoryID= value; } } |
public interface ICategoryDelete { string CategoryID { get; set; } } public void Delete(ICategoryDelete logic) { if (!NClay.Common.IsEmpty(logic.CategoryID)) { if ((DB.Post.CategoryID == logic.CategoryID).CountOf<Entities.Post>() > 0) { throw new LogicException("有文章在此类别中不能删除!"); } (DB.Category.CategoryID == logic.CategoryID).Delete<Entities.Category>(); } } |
[NClay.MVC.Action(ActionType = NClay.MVC.ActionType.All, Tag = "~/Default.aspx", Services = new Type[] { typeof(Logic.Post.IPostView) })] public class Default :BaseView ,Logic.Post.IPostView { #region IPostView 成员 public string CategoryID { get; set; } public System.Collections.Generic.IList<SmallBlog.Entities.PostView> Posts { get; set; } #endregion #region IDataPageProperty 成员 [NClay.MVC.Bind(typeof(NClay.DataPage))] public NClay.IDataPage DataPage { get; set; } #endregion } |
[NClay.MVC.ViewAspect(NClay.MVC.AspectLevel.High)] public class AspectBaseView:NClay.MVC.IAspect { #region IAspect 成员 public void Aspect(object source, NClay.MVC.AspectHandler e) { if (source is BaseView) { BaseView bv = (BaseView)source; NClay.MVC.Container.Execute<Logic.SysUser.IBlogConfig>(bv, true); NClay.MVC.Container.Execute<Logic.Category.IStatCategories>(bv, true); NClay.MVC.Container.Execute<Logic.Post.IHotPost>(bv, true); } e.Execute(source); } #endregion } |
[NClay.MVC.LogicAspect(typeof(Logic.SysUser.IBlogConfig), typeof(Logic.SysUser.IEditUserInfo))] public class BlogConfigCache : NClay.MVC.IAspect { #region IAspect 成员 public void Aspect(object source, NClay.MVC.AspectHandler e) { if (source is Logic.SysUser.IBlogConfig) { Logic.SysUser.IBlogConfig config = (Logic.SysUser.IBlogConfig)source; config.OwnerConfig = CacheUnit.GetBlogConfig(); if (config.OwnerConfig == null) { e.Execute(source); CacheUnit.SetBlogConfig(config.OwnerConfig); } } if (source is Logic.SysUser.IEditUserInfo) { e.Execute(source); CacheUnit.ClearBlogConfig(); } } #endregion } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者