Esempio n. 1
0
        private ResolveItem resolveJoinTable(QuryResultColumnInfo column, TableMetaData table, string prefix)
        {
            foreach (var item in table.JoinTables.Values)
            {
                if (item.Table.Columns.ContainsKey(column.Name))
                {
                    return(new ResolveItem()
                    {
                        PropertyName = item.Table.Columns[column.Name].PorpertyName,
                        ColumnIndex = column.Index,
                        PropertyType = item.Table.Columns[column.Name].RelatedType,
                        Parent = prefix + item.PropertyName,
                        Setter = item.Table.Columns[column.Name].Setter
                    });
                }

                // iterate recurserve
                foreach (var joinTbale in item.Table.JoinTables.Values)
                {
                    var result = resolveJoinTable(column, joinTbale.Table, prefix + item.PropertyName);

                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
Esempio n. 2
0
        private ResolveItem resolveJoinTableJoinColumn(QuryResultColumnInfo column, TableMetaData table, string[] segs, string prefix)
        {
            foreach (var jointable in table.JoinTables.Values)
            {
                var result = resolveJoinColumn(column, jointable.Table, segs, jointable.PropertyName);

                if (result != null)
                {
                    return(result);
                }

                result = resolveJoinTableJoinColumn(column, jointable.Table, segs, prefix + jointable.PropertyName);

                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }
Esempio n. 3
0
        private ResolveItem resolveJoinColumn(QuryResultColumnInfo column, TableMetaData table, string[] segs, string prefix)
        {
            if (segs.Length == 1)
            {
                if (table.Columns.ContainsKey(segs[0]))
                {
                    return(new ResolveItem()
                    {
                        PropertyName = segs[0],
                        PropertyType = table.Columns[segs[0]].RelatedType,
                        Parent = prefix,
                        ColumnIndex = column.Index,
                        Setter = table.Columns[segs[0]].Setter
                    });
                }
            }
            else
            {
                if (table.JoinColumns.ContainsKey(segs[0]))
                {
                    var array = new string[segs.Length - 1];

                    Array.Copy(segs, 1, array, 0, array.Length);

                    prefix = prefix == string.Empty ? table.JoinColumns[segs[0]].PropertyName
                                               : prefix + "_" + table.JoinColumns[segs[0]].PropertyName;

                    var result = resolveJoinColumn(column, table.JoinColumns[segs[0]].Table, array, prefix);

                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }