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"},
                    }
                });
         */
      }
    }
  • 相关阅读:
    如何使用Doxygen生成keil工程的代码文档 (how to use doxygen properly with keil)
    使用matlab画相交的平面
    转载:关于循环异步操作 Promise 实现,ES7 的 await 和 async
    小众软件:相见恨晚的 Windows 系统下的 cmd 的命令行替代者 Cmder(完美神器)
    Windows系统环境下Python脚本实现全局“划词复制”功能
    Ubuntu shell 命令行路径缩短
    shell查找数组是否有特定的值
    保存数据到文件
    左值与右值
    进程与线程的区别
  • 原文地址:https://www.cnblogs.com/luomingui/p/5832505.html
Copyright © 2011-2022 走看看