Ejemplo n.º 1
0
        /// <summary>
        /// Invokes the Component async.
        /// </summary>
        /// <param name="org">Unique identifier of the organisation responsible for the app.</param>
        /// <param name="app">Application identifier which is unique within an organisation.</param>
        /// <param name="serviceMetadata">The service metadata.</param>
        /// <param name="codeCompilationResult">The code compilation result.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <IViewComponentResult> InvokeAsync(
            string org,
            string app,
            ServiceMetadata serviceMetadata             = null,
            CodeCompilationResult codeCompilationResult = null)
        {
            var serviceIdentifier = new ServiceIdentifier {
                Org = org, Service = app
            };
            var compilation = codeCompilationResult ?? await CompileHelper.CompileService(_compilation, serviceIdentifier);

            var metadata = serviceMetadata ?? await GetServiceMetadata(serviceIdentifier);

            var model = CreateModel(serviceIdentifier, compilation, metadata);

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Compile(string org, string app)
        {
            if (string.IsNullOrWhiteSpace(org) || string.IsNullOrWhiteSpace(app))
            {
                return(BadRequest("Org or app not supplied"));
            }

            try
            {
                ServiceIdentifier serviceIdentifier = new ServiceIdentifier {
                    Org = org, Service = app
                };
                CodeCompilationResult compileResult = await CompileHelper.CompileService(_compilation, serviceIdentifier);

                return(Ok(compileResult));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Compiling services files for org: {org}, app: {app} failed with message: {ex.Message}");
                return(StatusCode(500, ex.Message));
            }
        }