Mercurial > pub > bltoolkit
diff Source/Data/Linq/Builder/SqlInfo.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Source/Data/Linq/Builder/SqlInfo.cs Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using BLToolkit.Reflection; + +namespace BLToolkit.Data.Linq.Builder +{ + using Data.Sql; + + public class SqlInfo + { + public ISqlExpression Sql; + public SqlQuery Query; + public int Index = -1; + public List<MemberInfo> Members = new List<MemberInfo>(); + + public SqlInfo() + { + } + + public SqlInfo(MemberInfo mi) + { + Members.Add(mi); + } + + public SqlInfo(IEnumerable<MemberInfo> mi) + { + Members.AddRange(mi); + } + + public SqlInfo Clone() + { + return new SqlInfo(Members) { Sql = Sql, Query = Query, Index = Index }; + } + + public SqlInfo Clone(MemberInfo mi) + { + var info = Clone(); + if (Members.Count == 0 || Members[0] != mi) + info.Members.Insert(0, mi); + else + { + + } + return info; + } + + public bool CompareMembers(SqlInfo info) + { + return Members.Count == info.Members.Count && !Members.Where((t, i) => !TypeHelper.Equals(t, info.Members[i])).Any(); + } + + 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]); + } + } +}