Skip to content

Conversation

@bart-vmware
Copy link
Member

@bart-vmware bart-vmware commented Feb 25, 2025

Changes in this PR

  • Added support for Steeltoe v4 and .NET 9
  • Options that don't apply for a Steeltoe version are silently ignored; all combinations of .NET/Steeltoe versions are allowed
  • Updated descriptions for CLI and IDE
  • Updated third-party NuGet packages to latest versions
  • Removed F# template version
  • Sync up template contents based on the default Web API project template
  • Added GitHub Actions workflow (no signing yet)
  • Removed Automated Release Notes by gren (site doesn't exist anymore)
  • Changes in command-line switches (dotnetcli.host.json)
    • Added --configuration-encryption (v4 only)
    • Added --configuration-spring-boot
    • Added --connector-cosmosdb
    • Added --connector-sqlserver-efcore
    • Added --discovery-consul
    • Renamed --logging-dynamic-logger to logging-dynamic-console
    • Added --logging-dynamic-serilog
    • Added --management-tasks
    • Removed --messaging-rabbitmq (equivalent to --messaging-rabbitmq-client and --messaging-rabbitmq-listener), doesn't currently exist at start.steeltoe.io and for IDEs)
    • Added --data-protection-redis
    • Reordered entries (non-alphabetical), because order is how they appear in --help
  • Changes in Visual Studio template (ide.host.json)
    • Added missing entries that only existed in CLI (there was no way to specify Steeltoe version)
    • Shortened the checkbox labels, added hover descriptions, indicate Steeltoe v3/v4 only
    • Added drop-down for Steeltoe version (in CLI, this is a free-format string)
    • Reordered entries (non-alphabetical), because order is how they appear in UI
  • Changes in core template (template.json)
    • Changed author from VMware to Broadcom
    • Fix classifictions (categories shown in VS)
    • Set default project name, so VS suggests "SteeltoeWebApi1"
    • Cleanup conditional symbols: *Option is an incoming switch, Is* and HasAny* are calculated, *InSteeltoeV3|4 is version-specific
    • Clarify option texts (these appear in CLI only)
  • Updated metadata for produced Steeltoe.NetCoreTool.Templates NuGet package
  • Template Content directory
    • Move generated files to root of project to simplify usings
    • Use Minimal APIs instead of controllers
    • Renamed SampleContext to AppDbContext, use modern C# syntax
    • Updated launchsettings.json for http and https (port numbers are replaced during generate)
    • Removed Models/ErrorViewModel.cs, never used anywhere
    • Updated .gitignore
    • appsettings[.Development].json: only emit Steeltoe schema for v3
    • Added [name].http file
    • PackageReference changes in project file
      • Added entries for Steeltoe v4
      • Removed Microsoft.AspNetCore.Authentication.AzureAD.UI (unused)
      • Added missing Connector driver packages
      • Replaced System.Data.SqlClient with Microsoft.Data.SqlClient
      • Organized entries alphabetically
      • Downgrade RabbitMQ.Client version from 6.4.* to 5.2.* for Steeltoe v3, to fix reflection crash at /sendtoqueue endpoint
    • Refresh Dockerfile (varies per .NET version)
    • Added nuget.config with Steeltoe dev feed (enables testing without published release)
    • Program.cs
      • Organized namespace imports alphabetically (for the most part), ensure no unused usings
      • Emit comment where Steeltoe setup begins, emit TODO comments for adding connection strings
      • Execution order unchanged (there may be subtle dependencies)
      • Changed builder.Configuration.AddConfigServer() to builder.AddConfigServer() (bugfix 3.x)
      • Changed builder.Services.AddAllActuators(builder.Configuration); builder.Services.ActivateActuatorEndpoints(); with builder.AddAllActuators(); (bugfix 3.x)
      • Changed builder.Services.AddDistributedTracingAspNetCore(); to also call builder.Services.AddDistributedTracing(); for HttpClient (bugfix 3.x)
      • Removed app.UseRouting();, which doesn't appear anymore in modern templates (aspnet auto-inserts it in the pipeline)
  • Cleanup Directory.Build.props files
  • Fix build warnings
  • Tests
    • Consolidated helpers into single project
    • Fixed wrong directory separators (depending on OS)
    • More reliable substring matching from tests (ie: assertions on "Microsoft.EntityFrameworkCore" and "Microsoft.EntityFrameworkCore.SqlServer" would succeed even when first one was missing)
    • Removed dead code and unused properties
    • Added test that runs all options combined
    • Generate .editorconfig in output directory, so a build error occurs when unused usings are found
    • Fail when <PackageReference> entries in template .csproj are unevaluated (because an undefined symbol is used)
    • Overall stronger assertions in tests, ie: match on AddConfigServer() does not distinguish between builder.Services.AddConfigServer(); and builder.AddConfigServer();

CLI output

> dotnet new steeltoe-webapi --language C# --help
Steeltoe ASP.NET Core Web API (C#)
Author: Broadcom
Description: A project template for creating a RESTful Web API using ASP.NET Core minimal APIs with Steeltoe components.

Usage:
  dotnet new steeltoe-webapi [options] [template options]

Options:
  -n, --name <name>       The name for the output being created. If no name is specified, the name of the output
                          directory is used.
  -o, --output <output>   Location to place the generated output.
  --dry-run               Displays a summary of what would happen if the given command line were run if it would result 
                          in a template creation.
  --force                 Forces content to be generated even if it would change existing files.
  --no-update-check       Disables checking for the template package updates when instantiating a template.
  --project <project>     The project that should be used for context evaluation.
  -lang, --language <C#>  Specifies the template language to instantiate.
  --type <project>        Specifies the template type to instantiate.

Template options:
  -f, --framework <net6.0|net8.0|net9.0>  The target framework for the project.
                                          Type: choice
                                            net6.0  Target net6.0
                                            net8.0  Target net8.0
                                            net9.0  Target net9.0
                                          Default: net8.0
  -s, --steeltoe <steeltoe>               The Steeltoe version to use.
                                          Type: string
                                          Default: 4.0.*-*
  -D, --description <description>         Add a project description.
                                          Type: string
  --dockerfile                            Add a Dockerfile.
                                          Type: bool
                                          Default: false
  --no-restore                            If specified, skips the automatic restore of the project on create.
                                          Type: bool
                                          Default: false
  --circuit-breaker-hystrix               Add support for Netflix Hystrix, a latency and fault tolerance library
                                          (Steeltoe 3.x only).
                                          Type: bool
                                          Default: false
  --hosting-cloud                         Add support for listening on the port specified by the hosting environment
                                          (Steeltoe 3.x only).
                                          Type: bool
                                          Default: false
  --hosting-azure-spring-cloud            Add hosting support for running on Microsoft Azure Spring Cloud (Steeltoe 3.x 
                                          only).
                                          Type: bool
                                          Default: false
  --hosting-cloud-foundry                 Add hosting support for running on Cloud Foundry.
                                          Type: bool
                                          Default: false
  --configuration-cloud-config            Add a client for Spring Cloud Config Server to configuration.
                                          Type: bool
                                          Default: false
  --configuration-encryption              Add decryption of encrypted settings in configuration (Steeltoe 4.0 or
                                          higher).
                                          Type: bool
                                          Default: false
  --configuration-placeholder             Add placeholder substitution to configuration.
                                          Type: bool
                                          Default: false
  --configuration-random-value            Add random value generation to configuration.
                                          Type: bool
                                          Default: false
  --configuration-spring-boot             Add support for reading Spring Boot-style keys from configuration.
                                          Type: bool
                                          Default: false
  --connector-cosmosdb                    Add a connector for CosmosDB databases.
                                          Type: bool
                                          Default: false
  --connector-mongodb                     Add a connector for MongoDB databases.
                                          Type: bool
                                          Default: false
  --connector-mysql                       Add a connector for MySQL databases using ADO.NET.
                                          Type: bool
                                          Default: false
  --connector-mysql-efcore                Add a connector for MySQL databases using Entity Framework Core.
                                          Type: bool
                                          Default: false
  --connector-oauth                       Add a connector for OAuth2 security on Cloud Foundry (Steeltoe 3.x only).
                                          Type: bool
                                          Default: false
  --connector-postgresql                  Add a connector for PostgreSQL databases using ADO.NET.
                                          Type: bool
                                          Default: false
  --connector-postgresql-efcore           Add a connector for PostgreSQL databases using Entity Framework Core.
                                          Type: bool
                                          Default: false
  --connector-rabbitmq                    Add a connector for RabbitMQ message brokers.
                                          Type: bool
                                          Default: false
  --connector-redis                       Add a connector for Redis data stores.
                                          Type: bool
                                          Default: false
  --connector-sqlserver                   Add a connector for Microsoft SQL Server databases using ADO.NET.
                                          Type: bool
                                          Default: false
  --connector-sqlserver-efcore            Add a connector for Microsoft SQL Server databases using Entity Framework
                                          Core.
                                          Type: bool
                                          Default: false
  --discovery-consul                      Add a service discovery client for HashiCorp Consul.
                                          Type: bool
                                          Default: false
  --discovery-eureka                      Add a service discovery client for Netflix Eureka.
                                          Type: bool
                                          Default: false
  --logging-dynamic-console               Enable dynamically changing minimum levels at runtime using the .NET console
                                          logger.
                                          Type: bool
                                          Default: false
  --logging-dynamic-serilog               Enable dynamically changing minimum levels at runtime using Serlog.
                                          Type: bool
                                          Default: false
  --management-endpoints                  Add management endpoints, providing info about versions, configuration,
                                          mapped routes and HTTP traffic, heap/thread dumps, health checks and changing 
                                          log levels.
                                          Type: bool
                                          Default: false
  --management-tasks                      Add task execution, based on command-line arguments.
                                          Type: bool
                                          Default: false
  --distributed-tracing                   Add distributed tracing support.
                                          Type: bool
                                          Default: false
  --messaging-rabbitmq-client             Add a RabbitMQ client service for sending and receiving messages (Steeltoe
                                          3.x only).
                                          Type: bool
                                          Default: false
  --messaging-rabbitmq-listener           Add a RabbitMQ listener service for processing messages (Steeltoe 3.x only).
                                          Type: bool
                                          Default: false
  --data-protection-redis                 Configure the ASP.NET data protection system to persist keys in a Redis
                                          database.
                                          Type: bool
                                          Default: false

Visual Studio 2022

image

image

image

Visual Studio Code

image

JetBrains Rider

image

Fixes #85.

@bart-vmware bart-vmware force-pushed the update-for-Steeltoe-v4 branch 8 times, most recently from 126d055 to 19b334f Compare February 25, 2025 13:50
@bart-vmware bart-vmware force-pushed the update-for-Steeltoe-v4 branch 2 times, most recently from 4f7adf1 to 9c6ffdc Compare February 27, 2025 21:41
@bart-vmware bart-vmware changed the title Update for Steeltoe v4 Update for Steeltoe v4 and .NET 9 Feb 28, 2025
@bart-vmware bart-vmware force-pushed the update-for-Steeltoe-v4 branch from a439ba9 to b885174 Compare February 28, 2025 03:56
@bart-vmware bart-vmware force-pushed the update-for-Steeltoe-v4 branch 2 times, most recently from 68db30f to 9825fc9 Compare February 28, 2025 11:42
@bart-vmware bart-vmware force-pushed the update-for-Steeltoe-v4 branch from 9825fc9 to a4928c4 Compare February 28, 2025 12:10
@bart-vmware bart-vmware marked this pull request as ready for review February 28, 2025 12:23
@bart-vmware bart-vmware requested a review from TimHess February 28, 2025 12:23
@TimHess TimHess merged commit 867350e into main Mar 3, 2025
5 checks passed
@TimHess TimHess deleted the update-for-Steeltoe-v4 branch March 3, 2025 17:06
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.

Connector.EFCore relationship with Connector.ConnectorCore

3 participants