private void AddResolverMapping(VmPropertyMappingsFinder.Settings i, Type resolverType)
 {
     ManualMaps.Add(new YuzuFullPropertyMapperSettings()
     {
         Mapper             = typeof(IYuzuFullPropertyMapper),
         Resolver           = resolverType,
         SourcePropertyName = i.SourcePropertyName,
         DestPropertyName   = i.DestPropertyName
     });
 }
Esempio n. 2
0
        public FormAutoMapping(IVmPropertyMappingsFinder vmPropertyMappingsFinder)
        {
            var formMappings = vmPropertyMappingsFinder.GetMappings <vmBlock_DataForm>();

            foreach (var i in formMappings)
            {
                if (i.SourceType != null)
                {
                    var resolverType = typeof(FormValueResolver <,>).MakeGenericType(i.SourceType, i.DestType);

                    ManualMaps.Add(new YuzuFullPropertyMapperSettings()
                    {
                        Mapper             = typeof(IYuzuFullPropertyMapper),
                        Resolver           = resolverType,
                        SourcePropertyName = i.SourcePropertyName,
                        DestPropertyName   = i.DestPropertyName
                    });
                }
            }
        }
Esempio n. 3
0
        public SubBlocksMappings(IVmPropertyMappingsFinder vmPropertyMappingsFinder)
        {
            var listOfObjectsMappings = vmPropertyMappingsFinder.GetMappings <object>();

            foreach (var i in listOfObjectsMappings)
            {
                if (i.SourceType != null && i.SourceProperty != null && i.SourceProperty.PropertyType == typeof(IPublishedContent))
                {
                    var resolverType = typeof(SubBlocksObjectResolver <,>).MakeGenericType(i.SourceType, i.DestType);

                    ManualMaps.Add(new YuzuFullPropertyMapperSettings()
                    {
                        Mapper             = typeof(IYuzuFullPropertyMapper),
                        Resolver           = resolverType,
                        SourcePropertyName = i.SourcePropertyName,
                        DestPropertyName   = i.DestPropertyName
                    });
                }
            }
        }
        private Type AddConfigMapping <V>(PropertyInfo destProperty, ConfigType type)
        {
            var path = "/rows/config";

            if (type == ConfigType.Cells)
            {
                path = "/rows/columns/config";
            }

            var ofType = schemaMetaService.GetOfType(destProperty, "refs");

            if (!string.IsNullOrEmpty(ofType))
            {
                var configTypeName = schemaMetaService.Get(typeof(V), "refs", path, ofType).FirstOrDefault();

                if (!string.IsNullOrEmpty(configTypeName))
                {
                    var configType = config.ViewModels.Where(x => x.Name == configTypeName).FirstOrDefault();

                    if (configType != null)
                    {
                        var configResolverType = typeof(GridConfigConverter <>).MakeGenericType(configType);
                        importConfig.IgnoreViewmodels.Add(configType.Name);

                        ManualMaps.Add(new YuzuTypeConvertorMapperSettings()
                        {
                            Mapper    = typeof(IYuzuTypeConvertorMapper),
                            Convertor = configResolverType
                        });

                        return(configType);
                    }
                }
            }

            return(null);
        }