Programming

Recursive Object Properties

Recursive Object Properties I’ve been working to create a virtual file system for SQL databases and represent this in a web interface. While creating the classes in .NET I realised that I needed to be able to traverse all the ancestors of a file up to the root level and Read more…

By Shinigami, ago
Programming

Splitting Lists Into Chunks

Splitting lists into chunks. Whilst writing a process to upload instore purchases to Facebook using their offline conversion API I discovered that their API only accepts a maximum of 2,100 events in any one API call. As I already ahd a nice list of events I had a look around Read more…

By Shinigami, ago
Programming

SqlDataReader Null Handling

SqlDataReader null handling When reading values from a SqlDataReader in .NET null SQL values will cause the reader to error. I used to have an explicit null check around each column, however as this involved quite a bit of code duplication I had a look for something better and found Read more…

By Shinigami, ago
Programming

SQL Stored Procedure In .NET

I generally end up forgetting how to return results from a SQL stored procedure within .NET so I figured I’d put it here for reference. public static List<Blog> GetBlogSummaries() { List<Blog> blogs = new List<Blog>(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BlogDatabase"].ConnectionString)) { using (SqlCommand command = new SqlCommand("sp__get_blog_summaries")) { command.CommandType Read more…

By Shinigami, ago