public override void Setup(DataMapperResolverArgs args)
{
base.Setup(args);
var scConfig = Configuration as SitecoreFieldConfiguration;
var property = args.PropertyConfiguration.PropertyInfo;
var type = Glass.Mapper.Utilities.GetGenericArgument(property.PropertyType);
var configCopy = scConfig.Copy();
configCopy.PropertyInfo = new FakePropertyInfo(type, property.Name, property.DeclaringType);
Mapper =
args.DataMappers.FirstOrDefault(
x => x.CanHandle(configCopy, args.Context) && x is AbstractSitecoreFieldMapper)
as AbstractSitecoreFieldMapper;
if (Mapper == null)
throw new MapperException(
"No mapper to handle type {0} on property {1} class {2}".Formatted(type.FullName, property.Name,
property.ReflectedType.FullName));
Mapper.Setup(new DataMapperResolverArgs(args.Context, configCopy));
}
}