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"},
                    }
                });
         */
      }
    }
  • 相关阅读:
    MORMOT数据库连接池
    TOleDBMSSQLConnectionProperties驱动MSSQL数据库
    mORMot访问远程数据库
    mormot 直接使用UNIDAC引擎操作数据库
    mormot 数据集和JSON互相转换
    Go -- 读取文件内容
    nginx -- 启动, 重启, 关闭
    JS -- 一篇文章掌握RequireJS常用知识
    用JS获取地址栏参数的方法(超级简单)
    git -- 忽略某个文件
  • 原文地址:https://www.cnblogs.com/luomingui/p/5832505.html
Copyright © 2011-2022 走看看