Exemplo n.º 1
0
        public IActionResult Code(string org, string service)
        {
            List <AltinnCoreFile> altinnCoreFiles = _repository.GetImplementationFiles(org, service);
            CodeCompilationResult compResult      = _compilation.CreateServiceAssembly(org, service, false, null, false);

            // Check to see if any of the files has compiliation errors or warnings
            foreach (AltinnCoreFile coreFile in altinnCoreFiles)
            {
                if (compResult.CompilationInfo != null &&
                    compResult.CompilationInfo.Exists(c => c.FileName.ToLower().Equals(coreFile.FileName.ToLower()) && c.Severity.Equals("Error")))
                {
                    coreFile.FileStatus = ServiceLibrary.Enums.AltinnCoreFileStatusType.Error;
                }
                else if (compResult.CompilationInfo != null &&
                         compResult.CompilationInfo.Exists(c => c.FileName.ToLower().Equals(coreFile.FileName.ToLower()) && c.Severity.Equals("Warning")))
                {
                    coreFile.FileStatus = ServiceLibrary.Enums.AltinnCoreFileStatusType.Warning;
                }
                else
                {
                    coreFile.FileStatus = ServiceLibrary.Enums.AltinnCoreFileStatusType.OK;
                }
            }

            string filePath = _settings.GetModelPath(org, service, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext)) + _settings.ServiceModelFileName;

            ViewBag.HasDataModel      = System.IO.File.Exists(filePath);
            ViewBag.CompilationResult = compResult;
            return(View(altinnCoreFiles));
        }
Exemplo n.º 2
0
        public IActionResult Code(string org, string service)
        {
            List <AltinnCoreFile> altinnCoreFiles = _repository.GetImplementationFiles(org, service);
            CodeCompilationResult compResult      = _compilation.CreateServiceAssembly(org, service, null, false);

            // Check to see if any of the files has compiliation errors or warnings
            foreach (AltinnCoreFile coreFile in altinnCoreFiles)
            {
                if (compResult.CompilationInfo != null &&
                    compResult.CompilationInfo.Exists(c => c.FileName.ToLower().Equals(coreFile.FileName.ToLower()) && c.Severity.Equals("Error")))
                {
                    coreFile.FileStatus = AltinnCore.ServiceLibrary.Enums.AltinnCoreFileStatusType.Error;
                }
                else if (compResult.CompilationInfo != null &&
                         compResult.CompilationInfo.Exists(c => c.FileName.ToLower().Equals(coreFile.FileName.ToLower()) && c.Severity.Equals("Warning")))
                {
                    coreFile.FileStatus = AltinnCore.ServiceLibrary.Enums.AltinnCoreFileStatusType.Warning;
                }
                else
                {
                    coreFile.FileStatus = AltinnCore.ServiceLibrary.Enums.AltinnCoreFileStatusType.OK;
                }
            }

            ViewBag.CompilationResult = compResult;
            return(View(altinnCoreFiles));
        }
Exemplo n.º 3
0
        private Task <CodeCompilationResult> Compile(ServiceIdentifier service)
        {
            Func <CodeCompilationResult> compile =
                () =>
                _compilation.CreateServiceAssembly(
                    service.Org,
                    service.Service);

            return(Task <CodeCompilationResult> .Factory.StartNew(compile));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates an asynchronous task for compiling an app
        /// </summary>
        /// <param name="compilation">The ICompilation implementation</param>
        /// <param name="identifier">The service identifier</param>
        /// <returns>The started compile task</returns>
        public static Task <CodeCompilationResult> CompileService(ICompilation compilation, ServiceIdentifier identifier)
        {
            Func <CodeCompilationResult> compile =
                () =>
                compilation.CreateServiceAssembly(
                    identifier.Org,
                    identifier.Service,
                    true);

            return(Task <CodeCompilationResult> .Factory.StartNew(compile));
        }