Mercurial > pub > bltoolkit
view Source/Data/Linq/Builder/SqlInfo.cs @ 1:8f65451dc28f
Исправлена проблема с фабрикой и выборкой нескольких объектов в linq выражении
author | cin |
---|---|
date | Fri, 28 Mar 2014 01:04:56 +0400 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
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]); } } }