Exemplo n.º 1
0
        internal void AdjustKeyDownward(ISerializableObject iso)
        {
            AttributeWorker w    = AttributeWorker.GetInstance(_sinkSerializer.Target);
            IVirtualKey     vKey = w.CreateVirtualKey(_sinkSerializer, _synchronizedType, iso.GetType());

            vKey.InitVirtualKeyBySource(FetchObject(_sinkSerializer, _sinkGuid));
            vKey.ApplyVirtualKeyToTarget(iso);
        }
Exemplo n.º 2
0
        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);
        }