泛型OQL,使用更方便

Editor
Dec 14, 2012 at 1:55 AM

    public class MyOQL<T> :OQL
        where T:EntityBase,new()
    {

        public MyOQL()
            : base(new T())
        {
        }

        public MyOQL(T e)
            :base(e)
        {           
        }

        public static OQL Form()
        {
            return OQL.From(new T());
        }
    }

查询实体时可以这样写

OQL q = BoruiOQL<yh>.Form().Select().END;

Coordinator
Jan 7, 2013 at 8:40 AM

不错,在一定程度上简化了OQL的使用,但这样Select方法里面就没法“选取字段”了。