OracleDataReader GetOrDefault() extension method

The various GetXXX methods of the OracleDataReader class take a zero-based column index instead of the column name. Referring columns by index instead of name leads to hard to understand code. Additionally, the code may be susceptible to errors if the column order is modified. …

Read

Download CSV using ASP.NET Web API

The CsvMediaTypeFormatter on Github makes it possible to support text/csv media type to the Web API stack. However, I wanted to rewrite it using the ToCsv() extension method from my earlier post. …

Read

IEnumerable ToCsv() extension method

In a recently concluded project that had many tabular reports, I had to display a link on each report to download the data as a comma-delimited file. Additionally, the downloaded file was expected to have a header row to help identify the columns when imported into excel. …

Read

NLog {asp-server-variables} renderer for ASP.NET

The NLog {asp-request} layout renderer requires specifying the keys in the nlog.config file. This works well if we need to log only a few keys. Otherwise, this approach will make the config file difficult to maintain. …

Read

ODP.NET CreateCommand() extension method

The amount of code to prepare an OracleCommand object to call a stored procedure is quite boring. I created a simple extension method on the OracleConnection class that makes things easiy. …

Read