I have a model
class Account
{
public string Name { get; set; }
public string EmailAddress1 { get; set; }
}
Is it possible to configure AutoMapper to somehow loop through each property on my class and map it to the correct Entity value.
I am able to make a converter with reflection myself:
public Entity ConvertToEntity()
{
var propertyDict = typeof(Account).GetProperties()
.Select(x => new KeyValuePair<string, object>(x.Name, x.GetValue(typeof(Account))));
var entity = new Entity();
foreach (var prop in propertyDict) t[prop.Key] = prop.Value;
return entity;
}
But how can i achieve the same kind of functionality with AutoMapper's CreateMap?