public List <DesignQueryObject> GetAvailableQueryObjects()
        {
            if (Schema == null)
            {
                return(new List <DesignQueryObject>());
            }

            var list = Schema.Definitions.Values.Select(d => new DesignQueryObject(d)).ToList();

            for (int i = 1; i < SubQueryList.Count; i++)
            {
                if (i != SelectedQueryIndex)
                {
                    var q = new DesignQueryObject(SubQueryList[i]);
                    list.Add(q);
                }
            }

            return(list);
        }
 public void AddFromTable(DesignQueryObject qo)
 {
     if (qo.IsSubQuery)
     {
         var ft = new QueryFromTable(qo.Query);
         ft.Alias = GetDefaultAlias(ft);
         SelectedQuery.FromTables.Add(ft);
         //RegenerateTableLinks();
         GenerateJoinsForNewTable(ft);
         _engine.SelectPropertiesFromNewTable(this, ft);
     }
     else
     {
         var ft = new QueryFromTable(qo.Table);
         ft.Alias = GetDefaultAlias(ft);
         SelectedQuery.FromTables.Add(ft);
         //RegenerateTableLinks();
         GenerateJoinsForNewTable(ft);
         _engine.SelectPropertiesFromNewTable(this, ft);
     }
 }