示例#1
0
        public List <T> FindAll <T>()
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(String.Format("select * from {0}", metaType.TableName));
            return(List <T>());
        }
示例#2
0
        public KQuery Union <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            sql += String.Format(" union select * from {0} {1}", metaType.TableName, where);
            return(this);
        }
示例#3
0
        public KQuery Select <T>(string where)
        {
            entityType = typeof(T);
            MetaType metaType = MetaManager.GetMetaType(entityType);

            sql = String.Format("select * from {0} {1}", metaType.TableName, where);
            return(this);
        }
示例#4
0
        public object Scalar <T>(string propertyName, string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select {0} from {1} {2}", propertyName, metaType.TableName, where)
                );
            return(Provider.QueryScalar(Command));
        }
示例#5
0
        public T Get <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select * from {0} {1}", metaType.TableName, where)
                );
            return(Get <T>());
        }
示例#6
0
        public int Count <T>(string where)
        {
            MetaType metaType = MetaManager.GetMetaType(typeof(T));

            Command = new Command(
                String.Format("select count(*) from {0} {1}", metaType.TableName, where)
                );
            object result = Provider.QueryScalar(Command);
            int    count  = 0;

            int.TryParse(result.ToString(), out count);
            return(count);
        }