#### [Abblix\.SecurityEvents](https://www.abblix.com/en/docs/api/abblix-securityevents 'index')
### [Abblix\.SecurityEvents\.Events](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Events 'Abblix\.SecurityEvents\.Events')

## EventTypeRegistry Class

Maps event identifier URIs to the payload types that model them, and deserializes payloads
through that map\.

```csharp
public sealed class EventTypeRegistry
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → EventTypeRegistry

### Remarks
The registry is filled during configuration and read at validation time; registration is not
synchronized, so it belongs at startup, which is where the DI extension calls it\. An event
dictionary package \- the CAEP one, for instance \- is nothing but a set of registrations over
this mechanism\.
### Constructors

## EventTypeRegistry\(JsonSerializerOptions\) Constructor {#Abblix.SecurityEvents.Events.EventTypeRegistry.EventTypeRegistry(System.Text.Json.JsonSerializerOptions)}

Maps event identifier URIs to the payload types that model them, and deserializes payloads
through that map\.

```csharp
public EventTypeRegistry(System.Text.Json.JsonSerializerOptions? serializerOptions=null);
```
#### Parameters

###### `serializerOptions` [System\.Text\.Json\.JsonSerializerOptions](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions 'System\.Text\.Json\.JsonSerializerOptions') {#Abblix.SecurityEvents.Events.EventTypeRegistry.EventTypeRegistry(System.Text.Json.JsonSerializerOptions).serializerOptions}

Options for payload deserialization; null takes the serializer's defaults\. Property\-name
matching stays exact either way \- wire names on payload types belong in
JsonPropertyName attributes, where the profiling specification's spelling is
visible next to the member it names\.

### Remarks
The registry is filled during configuration and read at validation time; registration is not
synchronized, so it belongs at startup, which is where the DI extension calls it\. An event
dictionary package \- the CAEP one, for instance \- is nothing but a set of registrations over
this mechanism\.
### Methods

## EventTypeRegistry\.Deserialize\(string, JsonObject\) Method {#Abblix.SecurityEvents.Events.EventTypeRegistry.Deserialize(string,System.Text.Json.Nodes.JsonObject)}

Deserializes an event's payload: into its registered type when the event identifier is
known, into [UnknownEventPayload](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Events.UnknownEventPayload 'Abblix\.SecurityEvents\.Events\.UnknownEventPayload') when it is not\.

```csharp
public Abblix.SecurityEvents.Events.IEventPayload Deserialize(string eventType, System.Text.Json.Nodes.JsonObject payload);
```
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.Events.EventTypeRegistry.Deserialize(string,System.Text.Json.Nodes.JsonObject).eventType}

The event identifier URI\.

###### `payload` [System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject') {#Abblix.SecurityEvents.Events.EventTypeRegistry.Deserialize(string,System.Text.Json.Nodes.JsonObject).payload}

The payload object from the "events" claim\.

#### Returns
[IEventPayload](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Events.IEventPayload 'Abblix\.SecurityEvents\.Events\.IEventPayload')  
The typed payload, never null\.

#### Exceptions

[System\.Text\.Json\.JsonException](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonexception 'System\.Text\.Json\.JsonException')  
The payload does not deserialize into the registered type\. A malformed payload of a KNOWN
type is a real error \- the transmitter and receiver disagree about a shape both claim to
know \- unlike an unknown type, which is the forward\-compatibility case the passthrough
exists for\.

## EventTypeRegistry\.Register\<TPayload\>\(string\) Method {#Abblix.SecurityEvents.Events.EventTypeRegistry.Register_TPayload_(string)}

Registers a payload type for an event identifier\.

```csharp
public void Register<TPayload>(string eventType)
    where TPayload : Abblix.SecurityEvents.Events.IEventPayload;
```
#### Type parameters

###### `TPayload` {#Abblix.SecurityEvents.Events.EventTypeRegistry.Register_TPayload_(string).TPayload}

The type modelling the event's payload\.
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.Events.EventTypeRegistry.Register_TPayload_(string).eventType}

The event identifier URI, exactly as transmitters spell it \- RFC 8417 Section 2\.2 asks for
stable values, and the comparison here is an exact string match\.

#### Exceptions

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
The event identifier is already registered\. Two types for one URI would make the answer to
"what does this event deserialize into" depend on registration order, which is the kind of
fact nobody can read off the code\.

## EventTypeRegistry\.TryGetPayloadType\(string, Type\) Method {#Abblix.SecurityEvents.Events.EventTypeRegistry.TryGetPayloadType(string,System.Type)}

Retrieves the payload type registered for an event identifier\.

```csharp
public bool TryGetPayloadType(string eventType, out System.Type payloadType);
```
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.Events.EventTypeRegistry.TryGetPayloadType(string,System.Type).eventType}

The event identifier URI\.

###### `payloadType` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.SecurityEvents.Events.EventTypeRegistry.TryGetPayloadType(string,System.Type).payloadType}

The registered type, when there is one\.

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')
