Ejemplo n.º 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>());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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>());
        }
Ejemplo n.º 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);
        }