Esempio n. 1
0
        /// <summary>
        /// 包含导航属性(EntityRef or EntitySet)
        /// </summary>
        public Includer Include(EntityMemberType memberType, ushort memberId)
        {
            EnsureIsNavigationMember(MemberType);

            if (Childs == null)
            {
                var res1 = new Includer(this, memberType, memberId);
                Childs = new List <Includer> {
                    res1
                };
                return(res1);
            }

            var found = Childs.FindIndex(t => t.MemberId1 == memberId);

            if (found >= 0)
            {
                return(Childs[found]);
            }

            var res = new Includer(this, memberType, memberId);

            Childs.Add(res);
            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// 新建子级
        /// </summary>
        private Includer(Includer parent, EntityMemberType memberType, ushort memberId)
        {
            EnsureIsNavigationMember(memberType);

            Parent     = parent ?? throw new ArgumentNullException(nameof(parent));
            MemberType = memberType;
            MemberId1  = memberId;
        }
Esempio n. 3
0
 /// <summary>
 /// 用于直接包含引用成员的字段,如t.Customer.Region.Name
 /// </summary>
 public Includer Include(string aliasName, ushort mid1, ushort mid2, ushort mid3 = 0)
 {
     if (rootIncluder == null)
     {
         rootIncluder = new Includer(modelId);
     }
     return(rootIncluder.Include(aliasName, mid1, mid2, mid3));
 }
Esempio n. 4
0
 /// <summary>
 /// 用于Include EntityRef or EntitySet
 /// </summary>
 public Includer Include(EntityMemberType memberType, ushort memberId)
 {
     if (rootIncluder == null)
     {
         rootIncluder = new Includer(modelId);
     }
     return(rootIncluder.Include(memberType, memberId));
 }
Esempio n. 5
0
 private Includer(Includer parent, string alias, ushort mid1, ushort mid2, ushort mid3 = 0)
 {
     Parent     = parent ?? throw new ArgumentNullException(nameof(parent));
     MemberType = EntityMemberType.DataField; //仅DataField
     AliasName  = alias;
     MemberId1  = mid1;
     MemberId2  = mid2;
     MemberId3  = mid3;
 }
Esempio n. 6
0
        /// <summary>
        /// 直接包含引用对象的字段,如order=>order.Customer.Name, 执行时作为Entity实例的附加成员
        /// </summary>
        /// <param name="alias">引用对象的成员的别名</param>
        public Includer Include(string alias, ushort mid1, ushort mid2, ushort mid3 = 0)
        {
            EnsureIsNavigationMember(MemberType);

            if (Childs == null)
            {
                Childs = new List <Includer>();
            }
            //TODO:考虑判断重复
            var res = new Includer(this, alias, mid1, mid2, mid3);

            Childs.Add(res);
            return(res);
        }