Thursday, April 30, 2015

Persistent Cache Repository using SQLite

A while back I blogged about an ICacheRepository. I still really like that concept, although admittedly there a few updates that I should make to the implementation.

The basic implementation that I shared before was for an in memory cache. There are plenty of document databases that I would recommend for you to use as a persistent cache mechanism, and they would also have the added benefit of being distributed across services.

What do you do if you need a persistent cache, but you don't have any of those document databases available? Just use files! By which I mean SQLite.

Would this stand up under load? Probably not.
Would I recommend that production systems use this? No.
Is it super simple to setup? Yes, yes it is!


Tuesday, April 21, 2015

Paged List for WebAPI

One of my favorite quotes is "there is nothing as embarrassing as yesterday's code." I blogged about a paged list class a while back, but I no longer like that here is a new one that includes WebAPI serialization support!

...but why is this useful?

You can use the simple IPagedList interface to pass paged data around all of your application, and then any object returned from your WebAPI that implements IPagedList will be automatically serialized for you. This allows you to create very consistent APIs that support paging.

IPagedList Interfaces

public interface IPagedList
    int PageIndex { get; }
    int PageSize { get; }
    int TotalCount { get; }
    IList List { get; }
public interface IPagedList<T> : IPagedList
    new IList<T> List { get; }

Thursday, April 9, 2015 Extensions Config v2.0

Last year I open sourced some code that allowed you to power your xUnit theories from a custom section in your application configuration file. I have now updated that project to support xUnit 2.0, and also to allow for an optional name attribute to be set on each data set.

    <add name="SampleProject.Class1.Main">
        <add index="0" name="Optional" p0="Hello" p1="World" />
        <add index="1" name="Cows" p0="Goodnight" p1="Moon" />


Real Time Web Analytics