Example #1
0
 /// <summary>
 /// 实体关联
 /// </summary>
 /// <param name="filedName">新建属性名称</param>
 /// <param name="entitySet">目标实体集</param>
 /// <param name="relateFiledName">关联属性名称</param>
 /// <param name="targetFiledName">关联目标实体集属性名称</param>
 /// <param name="relateType">关联类型</param>
 public void Relate(string filedName, EntitySet entitySet, string relateFiledName, string targetFiledName, EntityRelateType relateType)
 {
     int count = this.Count;
     for (int i = 0; i < count; i++)
     {
         Entity o = this[i];
         object val = o.Get(relateFiledName);
         if (relateType == EntityRelateType.OneToOne)
         {
             o.Set(filedName, entitySet.GetFirst(targetFiledName, val));
         }
         else if (relateType == EntityRelateType.OneToMany)
         {
             o.Set(filedName, entitySet.GetEntitySet(targetFiledName, val));
         }
     }
 }
Example #2
0
        public EntitySet GetEntitySet(string name, object val)
        {
            if (val == null)
                val = NULL_VALUE;

            List<Entity> entityList = this.GetList(name, val);
            EntitySet es = new EntitySet(entityList);
            return es;
        }
Example #3
0
 public static EntitySet GetEntitySet(ActionResponse res, string resultName)
 {
     ActionResult rs = res.GetResult(resultName);
     EntitySet es = new EntitySet();
     for (int i = 0; i < rs.Count; i++)
     {
         Entity o = new Entity(rs.GetDict(i));
         es.Add(o);
     }
     return es;
 }