Example #1
0
        public object ListFirst(Type type, IConnectinContext cc, params string[] orderby)
        {
            ObjectMapper     om    = ObjectMapper.GetOM(type);
            SelectDataReader sr    = om.GetSelectReader(type);
            string           strob = null;

            if (orderby != null && orderby.Length > 0)
            {
                strob = string.Join(",", orderby);
            }
            return(EntityBase.ExOnListFirst(type, cc, om.GetSelectTable(sr), this, strob, sr.Group));
        }
Example #2
0
        public RESULT ListFirst <T, RESULT>(IConnectinContext cc, params string[] orderby)
            where T : Mappings.DataObject, new()
            where RESULT : new()
        {
            Type             type  = typeof(T);
            ObjectMapper     om    = ObjectMapper.GetOM(typeof(T));
            SelectDataReader sr    = om.GetSelectReader(typeof(RESULT));
            string           strob = null;

            if (orderby != null && orderby.Length > 0)
            {
                strob = string.Join(",", orderby);
            }
            return((RESULT)EntityBase.ExOnListFirst(typeof(RESULT), cc, om.GetSelectTable(sr), this, strob, sr.Group));
        }
Example #3
0
        internal static object Load(Type type, object id, IConnectinContext cc)
        {
            Mappings.ObjectMapper     om = Mappings.ObjectMapper.GetOM(type);
            Mappings.SelectDataReader sr = om.GetSelectReader(type);
            if (om.ID == null)
            {
                throw new PeanutException(DataMsg.ID_MAP_NOTFOUND);
            }
            Expression exp = new Expression();

            exp.SqlText.Append(om.ID.ColumnName + "=@p1");
            exp.Parameters.Add(new Command.Parameter {
                Name = "p1", Value = id
            });
            return(EntityBase.ExOnListFirst(type, cc, om.GetSelectTable(sr), exp, null, null));
        }