In the little app I'm working on I'm using MongoDB...which is great, however MongoDB only supports storing Document objects. Which are kinda like Dictonaries (Document["blah"] = "bar";). I want to use AutoMapper to map these loosely types Key-Value Pairs to my objects and I'm basing it on some code I found drifting around: This works: Â public static IMappingExpression<Document, TDestination> ConvertFromDocument<TDestination>(this IMappingExpression<Document, TDestination> exp, Func<string, string> propertyNameMapper)
{
foreach (PropertyInfo pi in typeof(TDestination).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
...
I wrote this for use in a little project but as I'm no longer using it, I though I'd stick it on here for anyone who wants it. Essentially, this allows you to take a byte Array (in my case, in the File property of my ThumbnailViewModel) and get it back as a BitmapImage for use in DataBinding... It also has the property of accepting a parameter which lets you specify the size of thumbnail to use (ThumbSize). Here, I actually have multiple ThumbNails (in the List<ThumbNailViewModel>) and select one using the parameter. Given this resource string and...