示例#1
0
        public static A AddSibling <A>(IAbstractDal pSource, IOrdinal pOrdinal, bool pAddToQuery, string pCustomKey, bool pReadOnly = false, CustomKeyHand pHand = CustomKeyHand.Left)
            where A : IAbstractDal, new()
        {
            A lReturn = default(A);

            if (pAddToQuery || pOrdinal.SiblingsBitwise())
            {
                lReturn        = new A();
                lReturn.Parent = pSource;
                pSource.Query.AddEntityLeftJoinCustomKey(lReturn, pSource.EntityAlias, pCustomKey, pHand, pReadOnly);
                lReturn.GetOrdinal(pOrdinal);
            }
            else if (pSource.EntityAlias == "1" && pSource.Persistence && !pReadOnly)
            {
                lReturn = new A();
                pSource.Query.SaveAtributes.Add(pCustomKey, string.Concat("@", pCustomKey));
            }

            return(lReturn);
        }
示例#2
0
        public static A AddSibling <A>(IAbstractDal pSource, IOrdinal pOrdinal, bool pAddToQuery)
            where A : IAbstractDal, new()
        {
            A lReturn = default(A);

            if (pAddToQuery || pOrdinal.SiblingsBitwise())
            {
                lReturn        = new A();
                lReturn.Parent = pSource;
                pSource.Query.AddEntityLeftJoin(lReturn, pSource.EntityAlias);
                lReturn.GetOrdinal(pOrdinal);
            }
            else if (pSource.EntityAlias == "1" && pSource.Persistence)
            {
                lReturn = new A();
                pSource.Query.SaveAtributes.Add(lReturn.EntityKey, lReturn.EntityKey.Insert(0, "@"));
            }

            return(lReturn);
        }