Possible Duplicate:
Pass Type dynamically to <T>
How would I do something like the below? historyType is not a recognized type in Adapt.
Type historyType = Type.GetType("Domain.MainBoundedContext.CALMModule.Aggregates.LocationAgg." + modifiedEntry.GetType().Name + "History");
ServiceLocationHistory history = adapter.Adapt<ServiceLocation, historyType>(modifiedEntry as ServiceLocation);
historyRepository.Add(history);
Edit: I ended up doing this:
ServiceLocationHistory history = adapter.GetType()
.GetMethod("Adapt", new Type[] { typeof(ServiceLocation) })
.MakeGenericMethod(typeof(ServiceLocation), typeof(ServiceLocationHistory))
.Invoke(adapter, new object[] { modifiedEntry as ServiceLocation })
as ServiceLocationHistory;