public void ReplacePlaceHolders(QueryGenerator generator)
        {
            for (int i = 0; i < _QueryComponents.Count; i++)
            {
                if (_QueryComponents[i] is PlaceHolderComponent)
                {
                    _QueryComponents[i] = generator;
                }

                //Diese Variante endet sehr bald einen Stackoverflow --> keine Rekursion
                //else if (_QueryComponents[i] is QueryGenerator)
                //{
                //    ((QueryGenerator)_QueryComponents[i]).ReplacePlaceHolders(generator);
                //}
            }

            //Iteratives Vorgehen vermeidet den StachOverflow
            List<QueryComponent> tmp = new List<QueryComponent>();
            foreach (QueryComponent c in _QueryComponents)
            {
                if (c is QueryGenerator)
                {
                    tmp.AddRange(((QueryGenerator)c)._QueryComponents);
                }
                else
                {
                    tmp.Add(c);
                }
            }

            _QueryComponents = tmp;
        }
        protected StringBuilder ComputeSqlJoin(Serializer.Serializer serializer, IList<Type> path, String restriction, String target)
        {
            AttributeWorker w = AttributeWorker.GetInstance(target);

            QueryGenerator ret = new QueryGenerator();
            ret.AddQueryComponent(new PlaceHolderComponent());

            //StringBuilder b = new StringBuilder();
            //b.Append(" @@@");

            for (int i = 0; i < path.Count - 1; i++)
            {
                Type from = path[i];
                Type to = path[i + 1];
                //if (i > 0)
                //{
                //    b.Replace(" @@@", " WHERE  @@@");
                //}

                IVirtualKey vKey = w.CreateVirtualKey(serializer, from, to);
                QueryGenerator gen1 = vKey.ToSqlRestriction(target, from, to, serializer);
                ret.ReplacePlaceHolders(gen1);
                //b.Replace(" @@@", vKey.ToSqlRestriction(target, from, to));

                if (i==path.Count-2)
                {
                    QueryGenerator gen2 = new QueryGenerator();
                    gen2.AddQueryComponent(new SqlStringComponent(" WHERE "));
                    gen2.AddQueryComponent(new SqlStringComponent(restriction));
                    ret.ReplacePlaceHolders(gen2);

                    //b.Replace(" @@@", " WHERE  @@@");
                    //b.Replace(" @@@", restriction);
                }
            }

            if (path.Count == 1)
            {
                QueryGenerator gen3 = new QueryGenerator();
                gen3.AddQueryComponent(new SqlStringComponent(" WHERE "));
                gen3.AddQueryComponent(new SqlStringComponent(restriction));
                ret.ReplacePlaceHolders(gen3);

                //b.Replace(" @@@", " WHERE  @@@");
                //b.Replace(" @@@", restriction);
            }

            //Entferne das führende " WHERE "

            return ret.ToSqlString();

            //return b.Remove(0,7);
        }