public GridAutoMapping(IVmPropertyMappingsFinder vmPropertyMappingsFinder, ISchemaMetaService schemaMetaService, IYuzuConfiguration config, IYuzuDeliveryImportConfiguration importConfig)
        {
            this.schemaMetaService = schemaMetaService;
            this.config            = config;
            this.importConfig      = importConfig;

            var rowMappings = vmPropertyMappingsFinder.GetMappings <vmBlock_DataRows>();

            foreach (var i in rowMappings)
            {
                var  configType   = AddConfigMapping <vmBlock_DataRows>(i.DestProperty, ConfigType.Rows);
                Type resolverType = null;

                if (i.SourceType != null)
                {
                    if (configType == null)
                    {
                        resolverType = typeof(GridRowConvertor <,>).MakeGenericType(i.SourceType, i.DestType);
                    }
                    else
                    {
                        resolverType = typeof(GridRowConvertor <, ,>).MakeGenericType(i.SourceType, i.DestType, configType);
                    }

                    AddResolverMapping(i, resolverType);
                }
            }

            var gridMappings = vmPropertyMappingsFinder.GetMappings <vmBlock_DataGrid>();

            foreach (var i in gridMappings)
            {
                var rowsConfigType = AddConfigMapping <vmBlock_DataGrid>(i.DestProperty, ConfigType.Rows);
                var colsConfigType = AddConfigMapping <vmBlock_DataGrid>(i.DestProperty, ConfigType.Cells);

                Type resolverType = null;

                if (i.SourceType != null)
                {
                    if (rowsConfigType == null && colsConfigType == null)
                    {
                        resolverType = typeof(GridRowColumnConvertor <,>).MakeGenericType(i.SourceType, i.DestType);
                    }
                    else if (colsConfigType == null)
                    {
                        resolverType = typeof(GridRowColumnConvertor <, ,>).MakeGenericType(i.SourceType, i.DestType, rowsConfigType);
                    }
                    else
                    {
                        resolverType = typeof(GridRowColumnConvertor <, , ,>).MakeGenericType(i.SourceType, i.DestType, rowsConfigType, colsConfigType);
                    }

                    AddResolverMapping(i, resolverType);
                }
            }
        }
Esempio n. 2
0
 public FormTypeConvertor(ISchemaMetaService schemaMetaService)
 {
     this.schemaMetaService = schemaMetaService;
 }
Esempio n. 3
0
 public FormValueResolver(ISchemaMetaService schemaMetaService)
 {
     this.schemaMetaService = schemaMetaService;
 }