Class ValueObjectBinderConfiguration
Namespace: AdCodicem.ValueObjects.ProtobufNet
Assembly: AdCodicem.ValueObjects.ProtobufNet.dll
Builds the protobuf-net.Grpc binder configuration of a code-first server whose messages hold value objects.
public static class ValueObjectBinderConfiguration
Inheritance
object ← ValueObjectBinderConfiguration
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Fields
DefaultDomain
The google.rpc.ErrorInfo.domain a refusal is answered with when the application names none.
public const string DefaultDomain = "adcodicem.valueobjects"
Field Value
Methods
ForServer(TypeModel, string)
Builds a binder configuration for a code-first server: payloads go through the model, and a request value a value
object refuses is answered INVALID_ARGUMENT with the rule's code.
[RequiresDynamicCode("protobuf-net.Grpc binds a code-first service and closes its marshallers by reflection at run time.")]
public static BinderConfiguration ForServer(TypeModel model, string domain = "adcodicem.valueobjects")
Parameters
model TypeModel
The model the value objects are registered on,
domain string
The google.rpc.ErrorInfo.domain of a refusal, the service's name for instance.
Returns
BinderConfiguration
The configuration, which AddCodeFirstGrpc() reads from the service collection.
Remarks
Grpc.AspNetCore reads a request before any interceptor runs, and answers an exception its deserializer throws with
UNKNOWN, "Exception was thrown by handler.". The marshaller of this configuration turns an exception that
carries a rule's code, under grpc-status-details-bin: a
google.rpc.Status holding a google.rpc.ErrorInfo, whose reason is the code mapped by
metadata holds the code and the
valueObject. Neither the status nor the detail holds the value refused. A code that maps to no gRPC reason is
answered INVALID_ARGUMENT with the google.rpc.Status alone, without the ErrorInfo.
Everything else is protobuf-net.Grpc's own: the marshallers of ProtoBufMarshallerFactory.Create(model), then
those of Google.Protobuf messages, as in
Exceptions
model is null.
domain is empty or white space.