예제 #1
0
        IEnumerable <Proxy> GenerateReadModelProxy(Type artifact, ArtifactsConfiguration artifactsConfig, BuildTaskConfiguration configuration, Func <object, string> template)
        {
            _buildMessages.Trace($"Creating read model proxy for {ClrType.FromType(artifact).TypeString}");
            var artifactId          = GetArtifactId(artifact, artifactsConfig);
            var artifactDefinition  = GetArtifactDefinition(artifact, artifactsConfig);
            var handlebarsReadmodel = new HandlebarsReadmodel()
            {
                ReadModelName       = artifact.Name,
                ReadModelArtifactId = artifactId.Value.ToString(),
                ReadModelGeneration = artifactDefinition.Generation.Value.ToString()
            };
            var setableProperties = artifact.GetSettableProperties();

            if (setableProperties.Any())
            {
                handlebarsReadmodel.Properties = CreateProxyProperties(setableProperties);
            }

            var proxies = new List <Proxy>();

            foreach (var path in configuration.ProxiesBasePath)
            {
                proxies.Add(CreateProxy(artifact, template(handlebarsReadmodel), configuration, path));
            }
            return(proxies);
        }
예제 #2
0
        Proxy GenerateReadModelProxy(Type artifact, ArtifactsConfiguration artifactsConfig, ArgumentsParsingResult parsingResults, Func <object, string> template)
        {
            _logger.Trace($"Creating read model proxy for {ClrType.FromType(artifact).TypeString}");
            var artifactId          = GetArtifactId(artifact, artifactsConfig);
            var artifactDefinition  = GetArtifactDefinition(artifact, artifactsConfig);
            var handlebarsReadmodel = new HandlebarsReadmodel()
            {
                ReadModelName       = artifact.Name,
                ReadModelArtifactId = artifactId.Value.ToString(),
                ReadModelGeneration = artifactDefinition.Generation.Value.ToString()
            };
            var setableProperties = artifact.GetSettableProperties();

            if (setableProperties.Any())
            {
                handlebarsReadmodel.Properties = CreateProxyProperties(setableProperties);
            }

            return(CreateProxy(artifact, template(handlebarsReadmodel), parsingResults));
        }