zoukankan      html  css  js  c++  java
  • LCLFramework框架之开发约束

    Entity编写

    1:所有的实体类都必须继承DomainEntity
    2:所有的表都必须有 ID
    3:所有表的关系字段必须是ID
    [Serializable]
    public class User: DomainEntity
    {
        //public string Name { set; get; }
    }
    具体的Entity关系编写请查看LCLFramework实体关系
    服务编写:

    [Serializable]
    pulic class UserService:FlowService
     
    }
     扩展仓库:

    public interface IUserRepository : IRepository<User> 
    {
     
    }
    public class UserRepository : EntityFrameworkRepository<User>, IUserRepository
     {
          public UserRepository(IRepositoryContext context)  : base(context) 
            {
           
            }
            public User GetBy(string username, string password)
            {
                var users = base.Get(e => e.Code == username && e.Password == password);
                if (users.Count() > 0)
                {
                    return users.ToList()[0];
                }
                return null;
            }
    }
    插件编写:

    //表示当前程序集是一个插件
    public class LibraryPlugin : LCLPlugin
    {
       public override void Initialize(IApp app)
       {
          //在这里初始化插件本身
          /*
            初始化IOC:
            ServiceLocator.Instance.Register<IRepository<Org>, EntityFrameworkRepository<Org>>();
            初始化菜单:
            CommonModel.Modules.AddRoot(new MvcModuleMeta
             {
                    Label = "区域管理",
                    Bundle = this,
                    Children =
                    {
                        new MvcModuleMeta{Label = "小区管理", 
                           EntityType=typeof(VillageController),    //查询需要权限控制的action                        CustomUI="/UIShell.AreaManagementPlugin/Village/Index"},
                    }
                });
         */
      }
    }
  • 相关阅读:
    【华为云技术分享】ArcFace简介
    [学]PHP爬虫框架phpspider
    zend studio 自动注释、备注和常用有用快捷键
    mysql 为什么加了排序字段后不会自动按ID升序排序?
    【PHP转义字符】单引号双引号以及转义字符【原创】
    Javascript小结(四)----包装对象
    JavaScript小结(三)----字符串操作
    JavaScript小结(二)-----Date()函数
    Javascript小结(一)----prototype对象
    PHP底层原理分析和底层扩展编写
  • 原文地址:https://www.cnblogs.com/luomingui/p/5832505.html
Copyright © 2011-2022 走看看