示例#1
0
        public RESULT Avg <RESULT, Entity>(string field, bool DISTINCT, IConnectinContext cc) where Entity : Mappings.DataObject
        {
            ObjectMapper om    = ObjectMapper.GetOM(typeof(Entity));
            object       value = EntityBase.ExOnAggregation(cc, om.Table, "Avg", field, DISTINCT, this, null);

            if (value == null || value == DBNull.Value)
            {
                return(default(RESULT));
            }
            return((RESULT)Convert.ChangeType(value, typeof(RESULT)));
        }
示例#2
0
        public int Count <T>(string field, bool DISTINCT, IConnectinContext cc) where T : Mappings.DataObject
        {
            ObjectMapper om    = ObjectMapper.GetOM(typeof(T));
            object       value = EntityBase.ExOnAggregation(cc, om.Table, "count", field, DISTINCT, this, null);

            if (value == null || value == DBNull.Value)
            {
                return(0);
            }
            return((int)Convert.ChangeType(value, typeof(int)));
        }