Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual async Task <BoolResult> StartupAsync(Context context)
        {
            StartupStarted = true;

            var startupContentResult = await _contentReadOnlySession.StartupAsync(context).ConfigureAwait(false);

            if (!startupContentResult.Succeeded)
            {
                StartupCompleted = true;
                return(new BoolResult(startupContentResult, "Content session startup failed"));
            }

            var startupMemoizationResult = await _memoizationReadOnlySession.StartupAsync(context).ConfigureAwait(false);

            if (!startupMemoizationResult.Succeeded)
            {
                var sb = new StringBuilder();
                var shutdownContentResult = await _contentReadOnlySession.ShutdownAsync(context).ConfigureAwait(false);

                if (!shutdownContentResult.Succeeded)
                {
                    sb.Append($"Content session shutdown failed, error=[{shutdownContentResult}]");
                }

                sb.Append(sb.Length > 0 ? ", " : string.Empty);
                sb.Append($"Memoization session startup failed, error=[{startupMemoizationResult}]");
                StartupCompleted = true;
                return(new BoolResult(sb.ToString()));
            }

            StartupCompleted = true;
            return(BoolResult.Success);
        }