Skip to content

Instantly share code, notes, and snippets.

@KevM
Created September 13, 2011 19:29
Show Gist options
  • Select an option

  • Save KevM/1214820 to your computer and use it in GitHub Desktop.

Select an option

Save KevM/1214820 to your computer and use it in GitHub Desktop.
Automapper Fubu ideas?
//My advice (YMMV) :
//
//skip the view filter
//Only expose your normal U type actions to the action scanner (source)
//add a covention that prepends your U type actions with the appropriate automapperaction<T,U>
// * your devices to know what T goes with what U
public class AutoMapperConvention : IConfigurationAction
{
public void Configure(BehaviorGraph graph)
{
var autoMappedCalls = graph.Actions().Where(call => call.IsAutoMappedHandler());
autoMappedCalls.Each(action =>
{
var mapOutputType = action.InputType();
var mapInputType = //automap registry has this?
//var wrapActionWith = make generic authmapperaction type
var actionType = typeof(AutoMapAction<,>).MakeGenericType(mapInputType, mapOutputType);
var method = actionType.GetMethod("Get");
var mapAction = new ActionCall(actionType, method);
action.WrapWith(mapAction);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment