zoukankan      html  css  js  c++  java
  • OEA体验 :常用功能2

    一、摘要

           我下面写的是我在使用OEA中用到的功能,当然还有好多现在还没有用到,希望高手们多多指点指点。

    OEA 源码:OEA框架 2.9 Pre-Alpha 源码公布 可以到BloodyAngel 的博客和中可以下到。

    虽然作者的DEMO应经有了,但毕竟是写好的,只有自己动手才能更好的掌握这个框架,所谓体验决定深度嘛。

    二、本文大纲

           a、摘要 。

           b、DDD 之父子关系 。

    二、DDD 之父子关系

           DDD思想可以查考周哥的DDD - 使用聚合(Aggregate)来设计类库文章这里就不详述了。

    我们要实现的效果是:

    image

    在这里我们还是要用到 小区表 和 客户表 哦 小区表是父 客户表是子

    父(RootEntity):下面的代码有 OEAPropertyChildren 生成。

     1:  ///<summary>
     2:  ///描è述? : 街?道à小?区?.
     3:  ///<see>类à库a对?应|的?数y据Y库a表í NT_Clcs_Village </see>
     4:  ///</summary>
     5:  [Serializable]
     6:  [RootEntity]
     7:  public class Village : DemoEntity
     8:  {
     9:   
    10:      public static readonly Property<ClientinfoList> ClientinfoListProperty = P<Village>.Register(e => e.ClientinfoList);
    11:      [Association]
    12:      public ClientinfoList ClientinfoList
    13:      {
    14:          get { return this.GetLazyChildren(ClientinfoListProperty); }
    15:      }
    16:   }

    子(ChildEntity):下面的代码有 OEAPropertyReference 生成外键关系。

     1:  ///<summary>
     2:  ///描è述? : 客í户§信?息¢.
     3:  ///<see>类à库a对?应|的?数y据Y库a表í NT_Clcs_ClientInfo </see>
     4:  ///</summary>
     5:  [Serializable]
     6:  [ChildEntity]
     7:  public class Clientinfo : DemoEntity
     8:  {
     9:      public static readonly RefProperty<Village> VillageRefProperty =
    10:          P<Clientinfo>.RegisterRef(e => e.Village, ReferenceType.Parent);
    11:      public int VillageId
    12:      {
    13:          get { return this.GetRefId(VillageRefProperty); }
    14:          set { this.SetRefId(VillageRefProperty, value); }
    15:      }
    16:      public Village Village
    17:      {
    18:          get { return this.GetRefEntity(VillageRefProperty); }
    19:          set { this.SetRefEntity(VillageRefProperty, value); }
    20:      }
    21:   }

    注意:

     1:  internal class ClientinfoConfig : EntityConfig<Clientinfo>
     2:  {
     3:      protected override void ConfigView()
     4:      {
     5:          base.ConfigView();
     6:   
     7:          View.HasLabel("客户"); // 主要要加上这个哦,要不然系统会报警的。
     8:      }
     9:   
    10:  }
    11:  

    映射表:

     1:  internal class ClientinfoConfig : EntityConfig<Clientinfo>
     2:  {
     3:      protected override void ConfigMeta()
     4:      {
     5:          base.ConfigMeta();
     6:   
     7:          Meta.MapTable().HasColumns(
    11:              HouseHold.VillageRefProperty,
    13:              );
    14:      }
    15:   }
  • 相关阅读:
    基于jQuery的自定义插件:实现整屏分页转换的功能
    蝶恋花
    js中面向对象编程
    移动端web页面列表类上拉加载,查看详情,iframe嵌套第三方页面遇到的问题以及解决办法
    控制使用jquery load()方法载入新页面中的元素
    bootstrap-daterangepicker双日历控件开始日期选择问题
    点击select下拉框获取option的属性值
    bootstrap table表格前台分页,点击tab选项,重新刷新表格
    jquery中使元素显示和隐藏方法之间的区别
    jquery对象和DOM对象的相互转换
  • 原文地址:https://www.cnblogs.com/luomingui/p/2437295.html
Copyright © 2011-2022 走看看