Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (27 sloc) 1.074 kb
using FubuCore.Binding;
using FubuCore.Util;
namespace FubuTransportation
{
public class TransportationServiceArguments : ServiceArguments
{
public TransportationServiceArguments(object message) //possibly a message envelope for transport format
{
With<AggregateDictionary>(new TransportationAggregateDictionary(message));
}
}
public class TransportationAggregateDictionary : AggregateDictionary
{
private readonly Cache<string, object> propertyCache;
public TransportationAggregateDictionary(object message)
{
propertyCache = new Cache<string, object>(name =>
{
var property = message.GetType().GetProperty(name);
if (property == null) return null;
return property.GetValue(message, null);
});
AddLocator("Message Properties", source => propertyCache[source], () => propertyCache.GetAllKeys());
AddLocator("Message", source => message, () => new []{"Message"});
}
}
}
Jump to Line
Something went wrong with that request. Please try again.