Trimming Strings

Sometimes database data is messy. For instance, strings get entered with trailing (or leading) spaces. This can cause a lot of headaches when programming things like equality. Apparently "foo" != "foo "! Because of this, we have added the Trim attribute for model properties:

public class Model
    public string Name { get; set; }

Trimming All the Strings

If you have a lot of messy strings, and no leading/trailing whitespace is important to you, you can apply a global string trimmer:

var results = StoredProcedure.Create("usp_getDuplicateStrings")
                             .WithDataTransformer(new TrimAllStringsTransformer())

Last edited May 4, 2014 at 10:23 PM by aheidebrecht, version 1