Skip to content

Use a more standard way to configure razor console to hostbuilder/applicationhostbuilder#41

Merged
LittleLittleCloud merged 4 commits intomainfrom
u/xiaoyun/fix#26
Oct 20, 2025
Merged

Use a more standard way to configure razor console to hostbuilder/applicationhostbuilder#41
LittleLittleCloud merged 4 commits intomainfrom
u/xiaoyun/fix#26

Conversation

@LittleLittleCloud
Copy link
Member

@LittleLittleCloud LittleLittleCloud commented Oct 20, 2025

close #26

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a more standard way to configure Razor Console with .NET's IHostBuilder and HostApplicationBuilder, replacing the custom AppHost static methods with extension methods that integrate with the standard hosting model.

Key changes:

  • Replaces AppHost.RunAsync<T>() with Host.CreateDefaultBuilder().UseRazorConsole<T>()
  • Introduces HostBuilderExtension class with UseRazorConsole extension methods
  • Moves ConsoleAppOptions to a separate file and updates default configuration
  • Removes parameter passing functionality that was previously part of AppHost

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/RazorConsole.Core/AppHost.cs Refactored from static AppHost to HostBuilderExtension with standard host builder pattern
src/RazorConsole.Core/Rendering/ConsoleAppOptions.cs Extracted options class to separate file with updated defaults
src/RazorConsole.Tests/ConsoleAppTests.cs Updated test to use new host builder API pattern
src/RazorConsole.Gallery/Program.cs Migrated gallery app to use new host builder configuration
examples/LLMAgentTUI/Program.cs Updated example to use new host builder pattern
README.md Updated documentation with new API usage example

{
[Parameter]
public string? Message { get; set; }
public string Message { get; set; } = "Callback Test";
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Message property changed from nullable (string?) to non-nullable (string) with a default value. This removes the ability to test the component with null parameters, which may reduce test coverage for edge cases.

Suggested change
public string Message { get; set; } = "Callback Test";
public string? Message { get; set; }

Copilot uses AI. Check for mistakes.
BigBigMiao and others added 2 commits October 20, 2025 04:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Request: Use a more standard hosting syntax

3 participants