Posts

Showing posts from April, 2020

A generic database class

This is a class I use frequently for running SQL commands / queries: public   class   Database  :  IDatabase {      public   Database ( DatabaseConfiguration   config )     {          this . config   =   config ;     }      public   object [][]  RunQuery ( string   query ,  params   object []  args )     {          using  ( var   con   =   Connect ())          using  ( var   cmd   =   Prepare ( con ,  query ,  args ))              return   cmd . ExecuteReader () . Pipe ( ReadData );     }      public   void   RunNonQuery ( string ...