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" />
<PackageReference Include="MVFC.Aspire.Helpers" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=MVFC.Aspire.Helpers&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
MVFC.Aspire.Helpers: Biblioteca de helpers e extensões.MVFC.Aspire.Helpers.Api: API de exemplo com endpoints para MongoDB, Cloud Storage e Pub/Sub.MVFC.Aspire.Helpers.AppHost.AppHost: Orquestração de teste dos recursos usando Aspire.MVFC.Aspire.Helpers.AppHost.Tests: Testes automatizados para os endpoints.
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 | Versions 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.
-
net9.0
- Aspire.Hosting (>= 9.5.1)
- Bogus (>= 35.6.4)
- Google.Cloud.PubSub.V1 (>= 3.28.0)
- MongoDB.Driver (>= 3.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.