Runtime Csv Exporter using Dapper

Today I decided to create a run-time compiled Csv generator and compare it to a compile-time version of the same code. It works a treat with little noticeable difference in performance over 10000 runs (of a very small table) These are the compile time definitions: public class Client { public long id { get; set; } public string forenames {… Read more →

Convert Html to Tiff

using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Windows; using System.Windows.Forms; using System.Windows.Media.Imaging; class Program { private static WebBrowser InitialiseBrowser(string source) { // create a hidden web browser, which will navigate to the page WebBrowser browser = new WebBrowser(); browser.ScrollBarsEnabled = false; // we don’t want scrollbars on our image browser.ScriptErrorsSuppressed… Read more →

markdown in BlogEngine.NET

BlogEngine.NET has half baked support for markdown. You can install MarkdownFormatterExtension but this doesn’t do anything unless you enter raw text into the HTML editor view. There is an additional problem that the posts are saved as Xml and as such all the white space is removed during the save process. You can get around this by tweaking the Post… Read more →

Migrate from wordpress to blogengine.net

http://weblogs.asp.net/aghausman/archive/2009/07/20/migrate-from-wordpress-to-blogengine-net.aspx http://www.machinadei.com/cms/dev/importing-your-old-wordpress-posts-into-orchard-cms#.Uk7Kt9K-qfY http://wpblogml.codeplex.com/ use google prettify insert option from comments with defer in the header https://code.google.com/p/google-code-prettify/wiki/GettingStarted Read more →

NOT using repository pattern, use the ORM as is (EF)

This was originally posted as an answer to a question on stackoverflow here IMO both the Repository abstraction and the UnitOfWork abstraction have a very valuable place in any meaningful development. People will argue about implementation details, but just as there are many ways to skin a cat, there are many ways to implement an abstraction. Your question is specifically… Read more →

The simplest form of configurable Dependency Injection

public class MyClass { public static Func<string, string> GetConfigValue = s => ConfigurationManager.AppSettings[s]; //… Normal use: string connectionString = MyClass.GetConfigValue(“myConfigValue”); Custom (e.g. Unit Testing) use: MyClass.GetConfigValue = s => s == “myConfigValue” ? “Hi”, “string.Empty”; The simplest form of configurable Dependency Injection Read more →