MVFC.Aspire.Helpers 1.0.6

dotnet add package MVFC.Aspire.Helpers --version 1.0.6
                    
NuGet\Install-Package MVFC.Aspire.Helpers -Version 1.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MVFC.Aspire.Helpers" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.Aspire.Helpers" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="MVFC.Aspire.Helpers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MVFC.Aspire.Helpers --version 1.0.6
                    
#r "nuget: MVFC.Aspire.Helpers, 1.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MVFC.Aspire.Helpers@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MVFC.Aspire.Helpers&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=MVFC.Aspire.Helpers&version=1.0.6
                    
Install as a Cake Tool

MVFC.Aspire.Helpers

Conjunto de helpers para projetos .NET Aspire, incluindo integrações com Google Pub/Sub, Cloud Storage (emulador GCS) e MongoDB (com Replica Sets).

Visão Geral

Este projeto facilita a configuração e integração de recursos essenciais para aplicações distribuídas .NET Aspire, fornecendo métodos de extensão para:

  • Google Cloud Storage (emulador GCS)
  • MongoDB com Replica Set
  • Google Pub/Sub (emulador e UI)

Além disso, inclui uma API de exemplo (MVFC.Aspire.Helpers.Api) e um AppHost para orquestração (MVFC.Aspire.Helpers.AppHost.AppHost).

Estrutura do Projeto

Funcionalidades

Cloud Storage

  • Adiciona e integra um emulador GCS usando a imagem fsouza/fake-gcs-server.
  • Permite persistência opcional dos buckets via bind mount.
  • Exemplo de uso: CloudStorageExtensions.

MongoDB

  • Adiciona um container MongoDB configurado como Replica Set.
  • Inicializa automaticamente o Replica Set via script.
  • Exemplo de uso: MongoExtensions.

Pub/Sub

  • Adiciona o emulador do Google Pub/Sub e interface de administração (UI).
  • Cria tópicos e assinaturas automaticamente conforme configuração.
  • Suporte a assinaturas do tipo push e pull.
  • Exemplo de uso: PubSubExtensions.

API de Exemplo

  • Endpoints para testar integração com MongoDB, Cloud Storage e Pub/Sub:
    • /api/mongo
    • /api/bucket/{bucketName}
    • /api/pub-sub-enter
    • /api/pub-sub-exit
  • Implementações em Endpoints.

Instalação

Adicione o pacote NuGet ao seu projeto AppHost:

dotnet add package MVFC.Aspire.Helpers

Exemplo de Uso no AppHost

var builder = DistributedApplication.CreateBuilder(args);

var messageConfig = new MessageConfig(
                            TopicName: "test-topic",
                            SubscriptionName: "test-subscription",
                            PushEndpoint: "/api/pub-sub-exit");

var pubSubConfig = new PubSubConfig(
                            projectId: "test-project",
                            messageConfig: messageConfig);

IList<IMongoClassDump> dumps = [
    new MongoClassDump<TestDatabase>("TestDatabase", "TestCollection", 100,
        new Faker<TestDatabase>()
              .CustomInstantiator(f => new TestDatabase(f.Person.FirstName, f.Person.Cpf())))
];

builder.AddProject<Projects.MVFC_Aspire_Helpers_Api>("api-exemplo")
       .WithCloudStorage(builder, "cloud-storage", "./bucket-data")
       .WithMongoReplicaSet(builder, "mongo", dumps: dumps)
       .WithGcpPubSub(builder, "gcp-pubsub", pubSubConfig);

await builder.Build().RunAsync();
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 268 10/23/2025
1.0.5 174 10/23/2025
1.0.4 171 10/23/2025
1.0.3 170 10/22/2025
1.0.2 170 10/21/2025
1.0.1 169 10/21/2025
1.0.0 116 10/19/2025