![]() |
VOOZH | about |
dotnet add package ServiceModel.Grpc.DesignTime --version 1.23.0
NuGet\Install-Package ServiceModel.Grpc.DesignTime -Version 1.23.0
<PackageReference Include="ServiceModel.Grpc.DesignTime" Version="1.23.0" />
<PackageVersion Include="ServiceModel.Grpc.DesignTime" Version="1.23.0" />Directory.Packages.props
<PackageReference Include="ServiceModel.Grpc.DesignTime" />Project file
paket add ServiceModel.Grpc.DesignTime --version 1.23.0
#r "nuget: ServiceModel.Grpc.DesignTime, 1.23.0"
#:package ServiceModel.Grpc.DesignTime@1.23.0
#addin nuget:?package=ServiceModel.Grpc.DesignTime&version=1.23.0Install as a Cake Addin
#tool nuget:?package=ServiceModel.Grpc.DesignTime&version=1.23.0Install as a Cake Tool
ServiceModel.Grpc enables applications to communicate with gRPC services using a code-first approach (no .proto files), helps to get around limitations of gRPC protocol like "only reference types", "exact one input", "no nulls", "no value-types". Provides exception handling. Helps to migrate existing WCF solution to gRPC with minimum effort.
ServiceModel.Grpc.DesignTime is package with C# code generator for client and server-side assets.
A service contract is an interface decorated with the ServiceContract attribute. Interface methods decorated with the OperationContract attribute are treated as gRPC operations.
For example, following ICalculator contract with unary Sum operation and client streaming MultiplyBy operation:
[ServiceContract]
public interface ICalculator
{
[OperationContract]
Task<long> Sum(long x, int y, int z, CancellationToken token = default);
[OperationContract]
ValueTask<(int Multiplier, IAsyncEnumerable<int> Values)> MultiplyBy(IAsyncEnumerable<int> values, int multiplier, CancellationToken token = default);
}
For source code generation create a placeholder - a static partial class, name doesn’t matter. Configure which proxies should be generated via ImportGrpcService attribute.
[ImportGrpcService(typeof(ICalculator))]
internal static partial class MyGrpcServices
{
// generated code ...
public static IClientFactory AddCalculatorClient(this IClientFactory clientFactory, Action<ServiceModelGrpcClientOptions> configure = null) {}
}
Instruct ClientFactory to use a proxy from generated code.
IClientFactory clientFactory = new ClientFactory();
// register generated proxy for ICalculator
clientFactory.AddCalculatorClient();
// create an instance
ICalculator calculator = clientFactory.CreateClient<ICalculator>(channel);
Implement service.
internal sealed class Calculator : ICalculator
{
public Task<long> Sum(long x, int y, int z, CancellationToken token)
{
...
}
public ValueTask<(int Multiplier, IAsyncEnumerable<int> Values)> MultiplyBy(IAsyncEnumerable<int> values, int multiplier, CancellationToken token)
{
...
}
}
For source code generation create a placeholder - a static partial class, name doesn’t matter. Configure which endpoints should be generated via ExportGrpcService attribute.
[ExportGrpcService(typeof(Calculator), GenerateAspNetExtensions = true)]
internal static partial class MyGrpcServices
{
// generated code ...
public static IServiceCollection AddCalculatorOptions(this IServiceCollection services, Action<ServiceModelGrpcServiceOptions<Calculator>> configure) {}
// generated code ...
public static GrpcServiceEndpointConventionBuilder MapCalculator(this IEndpointRouteBuilder builder) {}
}
Instruct Grpc.AspNetCore.Server to use a proxy from generated code.
var builder = WebApplication.CreateBuilder();
// optional configuration for Calculator endpoint
builder.Services.AddCalculatorOptions(options => { ... });
var app = builder.Build();
// bind generated Calculator endpoint
app.MapCalculator();
[ExportGrpcService(typeof(Calculator), GenerateSelfHostExtensions = true)]
internal static partial class MyGrpcServices
{
// generated code ...
public static Server.ServiceDefinitionCollection AddCalculator(this Server.ServiceDefinitionCollection services, Func<Calculator> serviceFactory, Action<ServiceModelGrpcServiceOptions> configure = default) {}
// generated code ...
public static Server.ServiceDefinitionCollection AddCalculator(this Server.ServiceDefinitionCollection services, Calculator service, Action<ServiceModelGrpcServiceOptions> configure = default) {}
}
Instruct Grpc.Core.Server to use a proxy from generated code.
var server = new Grpc.Core.Server();
// bind generated Calculator endpoint with configuration
server.Services.AddCalculator(
() => new Calculator(),
options => { ... });
// or bind generated Calculator endpoint with default configuration
server.Services.AddCalculator(() => new Calculator());
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on ServiceModel.Grpc.DesignTime:
| Package | Downloads |
|---|---|
|
ServiceModel.Grpc.MemoryPackMarshaller
Library that enables applications to communicate with gRPC services using code-first approach, helps to get around some limitations of gRPC protocol. Provides exception handling. Helps to migrate existing WCF solution to gRPC with minimum effort. |
|
|
ServiceModel.Grpc.Nerdbank.MessagePackMarshaller
Library that enables applications to communicate with gRPC services using code-first approach, helps to get around some limitations of gRPC protocol. Provides exception handling. Helps to migrate existing WCF solution to gRPC with minimum effort. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.23.0 | 2,066 | 5/17/2026 |
| 1.22.1 | 251 | 4/3/2026 |
| 1.22.0 | 203 | 3/29/2026 |
| 1.21.0 | 4,281 | 12/21/2025 |
| 1.20.0 | 664 | 11/23/2025 |
| 1.19.0 | 1,959 | 11/9/2025 |
| 1.18.0 | 2,432 | 10/2/2025 |
| 1.17.0 | 2,790 | 8/31/2025 |
| 1.16.0 | 2,764 | 6/29/2025 |
| 1.15.0 | 1,151 | 6/15/2025 |
| 1.14.0 | 4,711 | 4/18/2025 |
| 1.13.0 | 5,608 | 2/2/2025 |
| 1.12.0 | 4,688 | 1/12/2025 |
| 1.11.1 | 1,174 | 11/30/2024 |
| 1.11.0 | 2,725 | 11/23/2024 |
| 1.10.1 | 3,079 | 10/19/2024 |
| 1.9.1 | 1,434 | 9/29/2024 |
| 1.9.0 | 3,899 | 7/21/2024 |
| 1.8.3 | 2,863 | 5/18/2024 |
| 1.8.2 | 1,904 | 3/2/2024 |