Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 5.5 KB

README.md

File metadata and controls

102 lines (71 loc) · 5.5 KB

OfX-gRPC

OfX-gRPC is an extension package for OfX that leverages gRPC for efficient data transportation. This package provides a high-performance, strongly-typed communication layer for OfX’s Attribute-based Data Mapping, enabling streamlined data retrieval across distributed systems.

Demo Project!


Introduction

gRPC-based Transport: Implements gRPC to handle data communication between services, providing a fast, secure, and scalable solution.


Installation

To install the OfX-gRPC package, use the following NuGet command:

dotnet add package OfX-gRPC

Or via the NuGet Package Manager:

Install-Package OfX-gRPC

How to Use

1. Register OfX-gRPC

Add OfX-gRPC to your service configuration during application startup:

For Client:

builder.Services.AddOfX(cfg =>
{
    cfg.AddContractsContainNamespaces(typeof(SomeContractAssemblyMarker).Assembly);
    cfg.AddGrpcClients(config => config
        .AddGrpcHostWithOfXAttributes("http://localhost:5001", [typeof(UserOfAttribute)])
        .AddGrpcHostWithOfXAttributes("http://localhost:5002", [typeof(CountryOfAttribute), typeof(ProvinceOfAttribute)...])
        ... //Other host configurations, you can also filter attributes by creating an interface and then filtering the attributes that implement the interface...
    ); //gRPC server host
});

For Server:

var builder = WebApplication.CreateBuilder(args);
...
var app = builder.Build();
...
app.MapOfXGrpcService();
...

After installing the package OfX-gRPC, you can use the extension method AddGrpcClients() for client and MapOfXGrpcService() for server. Look up at AddGrpcClients function, we have to define the contract assembly with server host, on this example above, all the queries are included in SomeContractAssemblyMarker assembly.

That All, enjoy your moment!

Package Name Description .NET Version Document
Core
OfX OfX core 8.0, 9.0 ReadMe
Integrations
OfX-HotChocolate OfX.HotChocolate is an integration package with HotChocolate for OfX. 8.0, 9.0 ReadMe
Data Providers
OfX-EFCore This is the OfX extension package using EntityFramework to fetch data 8.0, 9.0 ReadMe
OfX-MongoDb This is the OfX extension package using MongoDb to fetch data 8.0, 9.0 ReadMe
Transports
OfX-gRPC OfX.gRPC is an extension package for OfX that leverages gRPC for efficient data transportation. 8.0, 9.0 This Document
OfX-Kafka OfX-Kafka is an extension package for OfX that leverages Kafka for efficient data transportation. 8.0, 9.0 ReadMe
OfX-Nats OfX-Nats is an extension package for OfX that leverages Nats for efficient data transportation. 8.0, 9.0 ReadMe
OfX-RabbitMq OfX-RabbitMq is an extension package for OfX that leverages RabbitMq for efficient data transportation. 8.0, 9.0 ReadMe