Created
July 3, 2009 14:59
-
-
Save mhinze/140166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void MapAllPersistentObjects() | |
{ | |
var openType = typeof(IdToEntityConverter<>); | |
var guidType = typeof(Guid); | |
var allPersistentObjects = | |
from t in typeof(Customer).Assembly.GetTypes() | |
where typeof(Entity).IsAssignableFrom(t) | |
let converterType = openType.MakeGenericType(t) | |
select new {EntityType = t, ConverterType = converterType}; | |
allPersistentObjects.ForEach(t => CreateMap(guidType, t.EntityType).ConvertUsing(t.ConverterType)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment