/// <summary>
 /// Initializes a new instance of the <see cref="TsqlTargetRenderer"/> class.
 /// </summary>
 /// <param name="schemaResolver">The transformation schema resolver.</param>
 /// <param name="opRendererResolver">The operator renderer resolver.</param>
 /// <param name="references">The references manager.</param>
 /// <param name="tmpTables">The temporary tables informations.</param>
 /// <param name="mapper">The objects names mapper.</param>
 /// <param name="configuration">The configuration of the target.</param>
 /// <param name="envMapper">The environment names mapper.</param>
 /// <param name="logger">The errors logger.</param>
 public TsqlTargetRenderer(
     TransformationSchemaResolver schemaResolver,
     OperatorRendererResolver opRendererResolver,
     TemporaryTables tmpTables,
     IReferencesManager references,
     IMapper mapper,
     ITargetConfiguration configuration,
     IEnvironmentMapper envMapper,
     ILogger <ITargetRenderer> logger = null)
 {
     this._schemaResolver     = schemaResolver;
     this._opRendererResolver = opRendererResolver;
     this._tmpTables          = tmpTables;
     this._refs      = references;
     this._mapper    = mapper;
     this._conf      = configuration;
     this._envMapper = envMapper;
     this._logger    = logger;
 }
 public void AddTarget(string name, ITargetConfiguration targetConfiguration)
 {
     _targetConfigurations.Add(name, targetConfiguration);
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TargetBuilder"/> class.
 /// </summary>
 public TargetBuilder()
 {
     this._configuration = new TargetConfiguration();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PlantUmlTargetRenderer"/> class.
 /// </summary>
 /// <param name="configuration">The target configuration.</param>
 public PlantUmlTargetRenderer(ITargetConfiguration configuration)
 {
     this._conf     = configuration;
     this._fontSize = 12;
 }
Пример #5
0
        private static List <Target> MergeTargets(BuilderParameters parameters)
        {
            ValidateParameters(parameters);
            List <Target> result = new List <Target>();

            foreach (KeyValuePair <string, IApplicationConfiguration> applicationItem in parameters.ApplicationsConfiguration)
            {
                IApplicationConfiguration applicationConfiguration = applicationItem.Value;

                IReadOnlyDictionary <string, ITargetConfiguration> applicationTargets = null;
                IReadOnlyDictionary <string, ITargetConfiguration> targets;

                if (applicationConfiguration.Targets.Count > 0)                 // does the application define specific targets or not ?
                {
                    applicationTargets = applicationConfiguration.Targets;
                    targets            = FilterTargets(parameters.TargetsConfiguration, applicationTargets); //filter global list of targets to be restricted to the ones accepted by the application
                }
                else                                                                                         //if not, use all defined target in the global configuration
                {
                    targets = parameters.TargetsConfiguration;
                }

                //on each targets
                foreach (KeyValuePair <string, ITargetConfiguration> targetItem in targets)
                {
                    string targetName = targetItem.Key;
                    ITargetConfiguration targetConfiguration            = targetItem.Value;
                    ITargetConfiguration applicationTargetConfiguration = applicationTargets?[targetName];

                    IReadOnlyDictionary <string, IPlatformConfiguration> applicationTargetPlatforms = null;
                    IReadOnlyDictionary <string, IPlatformConfiguration> targetPlatforms            = null;
                    IReadOnlyDictionary <string, IPlatformConfiguration> platforms;

                    if (applicationTargetConfiguration != null && applicationTargetConfiguration.Platforms.Count > 0)
                    {
                        applicationTargetPlatforms = applicationTargetConfiguration.Platforms;
                        if (targetConfiguration.Platforms.Count > 0)
                        {
                            targetPlatforms = FilterPlatforms(targetConfiguration.Platforms, applicationTargetPlatforms);                   //filter list of platforms in target to the ones defined by the application
                        }
                        platforms = FilterPlatforms(parameters.PlatformsConfiguration, applicationTargetPlatforms);                         //filter global list of platforms to the ones defined in the application
                    }
                    else if (targetConfiguration.Platforms.Count > 0)
                    {
                        targetPlatforms = targetConfiguration.Platforms;
                        platforms       = FilterPlatforms(parameters.PlatformsConfiguration, targetPlatforms);                   //filter global list of platforms to be restricted to the ones accepted by the target
                    }
                    else
                    {
                        platforms = parameters.PlatformsConfiguration;
                    }

                    foreach (KeyValuePair <string, IPlatformConfiguration> platformItem in platforms)
                    {
                        string platformName = platformItem.Key;
                        IPlatformConfiguration platformConfiguration                  = platformItem.Value;
                        IPlatformConfiguration targetPlatformConfiguration            = targetPlatforms?[platformName];
                        IPlatformConfiguration applicationTargetPlatformConfiguration = applicationTargetPlatforms?[platformName];

                        IConfiguration rootLevel        = parameters.RootConfiguration;
                        IConfiguration switchLevel      = parameters.SwitchConfiguration;
                        IConfiguration platformLevel    = platformConfiguration;
                        IConfiguration targetLevel      = targetConfiguration;
                        IConfiguration applicationLevel = applicationConfiguration;

                        // merge platform specific detail in target level
                        if (targetPlatformConfiguration != null)
                        {
                            targetLevel = targetLevel.Merge(targetPlatformConfiguration);
                        }

                        // merge target and platform specific detail in application level
                        if (applicationTargetConfiguration != null)
                        {
                            IConfiguration applicationTargetLevel = applicationTargetConfiguration;
                            if (applicationTargetPlatformConfiguration != null)
                            {
                                applicationTargetLevel = applicationTargetLevel.Merge(applicationTargetPlatformConfiguration);
                            }
                            applicationLevel = applicationLevel.Merge(applicationTargetLevel);
                        }

                        IConfiguration configuration = rootLevel.Merge(switchLevel.Merge(platformLevel.Merge(targetLevel.Merge(applicationLevel))));
                        result.Add(new Target(applicationItem.Key, targetItem.Key, platformItem.Key, configuration));
                    }
                }
            }

            return(result);
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferencesManager"/> class.
 /// </summary>
 /// <param name="opRendererResolver">The operator renderer resolver.</param>
 /// <param name="configuration">The configuration of the target.</param>
 public ReferencesManager(OperatorRendererResolver opRendererResolver, ITargetConfiguration configuration)
 {
     this._opRendererResolver = opRendererResolver;
     this._conf = configuration;
     this.nonPersistentExprs = new Dictionary <IExpression, string>();
 }