private void ParseFrom(string fromClause)
        {
            const string LINKSQL   = "LEFT OUTER JOIN ";
            var          fromArray = fromClause.Split(new string[] { LINKSQL }, StringSplitOptions.RemoveEmptyEntries);
            var          index     = fromArray[0].IndexOf("]");
            var          tableName = fromArray[0].Substring(1, index - 1);

            _fromLinkList.Add(new LinqSQLFromClause(tableName, GetSchema(tableName), "t0", string.Empty));

            for (int ii = 1; ii < fromArray.Length; ii++)
            {
                var rawText = fromArray[ii];

                //Get Table
                index = rawText.IndexOf("]");
                var table = rawText.Substring(0, index + 1);
                rawText = rawText.Substring(table.Length + 4, rawText.Length - table.Length - 4);

                //Get Alias
                index = rawText.IndexOf("]");
                var alias = rawText.Substring(0, index + 1);

                //Get Link
                var linkClause = rawText.Substring(alias.Length + 1, rawText.Length - alias.Length - 1);

                _fromLinkList.Add(new LinqSQLFromClause(table, GetSchema(table), alias, linkClause));
            }
        }
        private void RemapParentChild()
        {
            //Include all base tables
            LinqSQLFromClauseCollection childTables = new LinqSQLFromClauseCollection();

            foreach (var fromClause in _fromLinkList)
            {
                //Do all field replacements
                if (_type == ObjectTypeConstants.Table)
                {
                    if (fromClause.TableName == "CanadaPostalCode")
                    {
                        childTables.Add(fromClause);
                    }
                    if (fromClause.TableName == "City")
                    {
                        childTables.Add(fromClause);
                    }
                    if (fromClause.TableName == "State")
                    {
                        childTables.Add(fromClause);
                    }
                    if (fromClause.TableName == "Zip")
                    {
                        childTables.Add(fromClause);
                    }
                }
                if (_type == ObjectTypeConstants.View)
                {
                }
            }
            _fromLinkList.Clear();
            _fromLinkList.AddRange(childTables);

            //Process the FROM clause
            _fromLinkList.RemapFromClause();

            //Now map the columns to the proper tables
            foreach (var field in this.FieldList)
            {
                LinqSQLFromClause clause    = _fromLinkList.FirstOrDefault(x => x.Alias == field.Table);
                string            realTable = string.Empty;
                if (_type == ObjectTypeConstants.Table)
                {
                    if (clause.TableName == "CanadaPostalCode")
                    {
                        realTable = Gravitybox.GeoLocation.EFDAL.Entity.CanadaPostalCode.GetTableFromFieldAliasSqlMapping(field.Alias);
                    }
                    else if (clause.TableName == "City")
                    {
                        realTable = Gravitybox.GeoLocation.EFDAL.Entity.City.GetTableFromFieldAliasSqlMapping(field.Alias);
                    }
                    else if (clause.TableName == "State")
                    {
                        realTable = Gravitybox.GeoLocation.EFDAL.Entity.State.GetTableFromFieldAliasSqlMapping(field.Alias);
                    }
                    else if (clause.TableName == "Zip")
                    {
                        realTable = Gravitybox.GeoLocation.EFDAL.Entity.Zip.GetTableFromFieldAliasSqlMapping(field.Alias);
                    }
                }
                var sqlFromClause = _fromLinkList.GetByTable(realTable);
                field.Table = sqlFromClause.Alias;
            }

            //Calculate the WHERE clause
            if (!string.IsNullOrEmpty(_whereClause))
            {
                foreach (var fromClause in _fromLinkList)
                {
                    //Only process table that were original and not inserted above
                    if (fromClause.AnchorAlias == string.Empty)
                    {
                        _whereClause = GetRemappedLinqSql(fromClause, _whereClause, _fromLinkList, _type);
                    }
                }
            }
        }