Ejemplo n.º 1
0
        public T FindEntityByWhere <T>(string WhereSql, DbParameter[] parameters) where T : new()
        {
            StringBuilder builder = DatabaseCommon.SelectSql <T>(1);

            builder.Append(WhereSql);
            return(DatabaseReader.ReaderToModel <T>(DbHelper.ExecuteReader(CommandType.Text, builder.ToString(), parameters)));
        }
Ejemplo n.º 2
0
        public T FindEntity <T>(string propertyName, object propertyValue) where T : new()
        {
            string        str     = propertyName;
            StringBuilder builder = DatabaseCommon.SelectSql <T>(1);

            builder.Append(" AND ").Append(str).Append("=").Append(DbHelper.DbParmChar + str);
            IList <DbParameter> source = new List <DbParameter> {
                DbFactory.CreateDbParameter(DbHelper.DbParmChar + str, propertyValue)
            };

            return(DatabaseReader.ReaderToModel <T>(DbHelper.ExecuteReader(CommandType.Text, builder.ToString(), source.ToArray <DbParameter>())));
        }
Ejemplo n.º 3
0
 public T FindEntityBySql <T>(string strSql, DbParameter[] parameters)
 {
     return(DatabaseReader.ReaderToModel <T>(DbHelper.ExecuteReader(CommandType.Text, strSql.ToString(), parameters)));
 }