示例#1
0
		void SetInfo(SqlInfo info)
		{
			info.Query = SqlQuery;

			if (info.Sql == SqlQuery)
				info.Index = SqlQuery.Select.Columns.Count - 1;
			else
				info.Index = SqlQuery.Select.Add(info.Sql);
		}
            void CheckAndAddMember(IBuildContext sequence1, IBuildContext sequence2, SqlInfo info)
            {
                var member = new Member
                {
                    SequenceInfo     = info,
                    MemberExpression = Expression.PropertyOrField(_unionParameter, info.Members[0].Name)
                };

                if (sequence1.IsExpression(member.MemberExpression, 1, RequestFor.Object).Result)
                {
                    throw new LinqException("Types in {0} are constructed incompatibly.", _methodCall.Method.Name);
                }

                var idx = sequence2.ConvertToIndex(member.MemberExpression, 1, ConvertFlags.Field);

                if (idx[0].Index != member.SequenceInfo.Index)
                {
                    throw new LinqException("Types in {0} are constructed incompatibly.", _methodCall.Method.Name);
                }

                _members.Add(member.MemberExpression.Member, member);
            }
示例#3
0
        public virtual SqlInfo[] ConvertToIndex(Expression expression, int level, ConvertFlags flags)
        {
            var key = Tuple.Create(expression, level, flags);

            SqlInfo[] info;

            if (!_expressionIndex.TryGetValue(key, out info))
            {
                info = ConvertToIndexInternal(expression, level, flags);

                var newInfo = new SqlInfo[info.Length];

                for (var i = 0; i < info.Length; i++)
                {
                    var ni = info[i];

                    if (ni.Query != SqlQuery)
                    {
                        ni = new SqlInfo
                        {
                            Query  = SqlQuery,
                            Member = ni.Member,
                            Index  = SqlQuery.Select.Add(ni.Query.Select.Columns[ni.Index])
                        };
                    }

                    newInfo[i] = ni;
                }

                _expressionIndex.Add(key, newInfo);

                return(newInfo);
            }

            return(info);
        }
示例#4
0
 public bool CompareLastMember(SqlInfo info)
 {
     return
         (Members.Count > 0 && info.Members.Count > 0 &&
          TypeHelper.Equals(Members[Members.Count - 1], info.Members[info.Members.Count - 1]));
 }
示例#5
0
 public bool CompareMembers(SqlInfo info)
 {
     return(Members.Count == info.Members.Count && !Members.Where((t, i) => !TypeHelper.Equals(t, info.Members[i])).Any());
 }
示例#6
0
		public bool CompareLastMember(SqlInfo info)
		{
			return
				Members.Count > 0 && info.Members.Count > 0 &&
				TypeHelper.Equals(Members[Members.Count - 1], info.Members[info.Members.Count - 1]);
		}
示例#7
0
		public bool CompareMembers(SqlInfo info)
		{
			return Members.Count == info.Members.Count && !Members.Where((t, i) => !TypeHelper.Equals(t, info.Members[i])).Any();
		}
示例#8
0
 public bool CompareMembers(SqlInfo info)
 {
     return(Members.Count == info.Members.Count && !Members.Where((t, i) => t != info.Members[i]).Any());
 }
示例#9
0
		public bool CompareMembers(SqlInfo info)
		{
			return Members.Count == info.Members.Count && !Members.Where((t, i) => t != info.Members[i]).Any();
		}