/// <summary> /// Sets up the data mapper for a particular property /// </summary> /// <param name="args">The args.</param> /// <exception cref="Glass.Mapper.MapperException">No mapper to handle type {0} on property {1} class {2}.Formatted(type.FullName, property.Name, /// property.ReflectedType.FullName)</exception> public override void Setup(DataMapperResolverArgs args) { base.Setup(args); var config = Configuration as UmbracoPropertyConfiguration; var property = args.PropertyConfiguration.PropertyInfo; var type = Utilities.GetGenericArgument(property.PropertyType); var configCopy = config.Copy(); configCopy.PropertyInfo = new FakePropertyInfo(type, property.Name, property.DeclaringType); Mapper = args.DataMappers.FirstOrDefault( x => x.CanHandle(configCopy, args.Context) && x is AbstractUmbracoPropertyMapper) as AbstractUmbracoPropertyMapper; 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)); }
/// <summary> /// Initializes a new instance of the <see cref="UmbracoPropertyNullableMapper{T, TMapper}" /> class. /// </summary> public UmbracoPropertyNullableMapper() : base(typeof(Nullable <T>)) { _baseMapper = new TMapper(); }