Path: redb-route/redb.Route.DataFormats.Protobuf/ProtobufRouteDefinitionExtensions.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.DataFormats.Protobuf/ProtobufRouteDefinitionExtensions.cs ---- using redb.Route.Abstractions; using redb.Route.Extensions; namespace redb.Route.DataFormats.Protobuf; /// DSL and registration sugar for . public static class ProtobufRouteDefinitionExtensions { /// Marshals the IMessage body to Protobuf bytes. public static IRouteDefinition MarshalProtobuf(this IRouteDefinition route, Action? configure = null) => route.Marshal(new ProtobufDataFormat(Build(configure))); /// Unmarshals Protobuf bytes to the generated message type . public static IRouteDefinition UnmarshalProtobuf(this IRouteDefinition route, Action? configure = null) => route.Unmarshal(new ProtobufDataFormat(Build(configure))); /// Registers Protobuf as application/x-protobuf on the context. public static IRouteContext AddProtobufDataFormat(this IRouteContext context, Action? configure = null) => context.AddDataFormat(new ProtobufDataFormat(Build(configure)), ProtobufDataFormat.Name); /// DI form of . public static RedbRouteBuilder AddProtobufDataFormat(this RedbRouteBuilder builder, Action? configure = null) => builder.AddDataFormat(new ProtobufDataFormat(Build(configure)), ProtobufDataFormat.Name); private static ProtobufDataFormatOptions Build(Action? configure) { var options = new ProtobufDataFormatOptions(); configure?.Invoke(options); return options; } }