i read the MapBuilder.cs source code in the ent lib 5.0;
some code seems so weird for me, i just can`t figurt out whats the purpose of doing so:
public static IMapBuilderContext<TResult> MapAllProperties()
{
IMapBuilderContext<TResult> context = new MapBuilderContext();
var properties =
from property in typeof(TResult).GetProperties(BindingFlags.Instance | BindingFlags.Public)
where IsAutoMappableProperty(property)
select property;
foreach (var property in properties)
{
context = context.MapByName(property);
}
return context;
}
in the MapAllProperties(), we get properties using Type.GetProperties(), then, in the MapByName(), we using a method called NormalizePropertyInfo() to get "another" property. i mean call Type.GetProperty() again!!!:
private static PropertyInfo NormalizePropertyInfo(PropertyInfo property)
{
if (property == null) throw new ArgumentNullException("property");
return typeof(TResult).GetProperty(property.Name);
}
why need calling the GetProperty() again? what`s the purpose of NormalizePropertyInfo()?
any help would be appreciated, thanks.