Skip to content

DictionaryTypeHandler`2 ​

Namespace: MJCZone.DapperMatic.TypeMapping.Handlers

Assembly: MJCZone.DapperMatic

Summary ​

Type handler for Dictionary<TKey, TValue> to support dictionary data across all database providers. Serializes Dictionary to JSON string for storage and deserializes JSON back to Dictionary.

Inheritance ​

Base Class: TypeHandler

public

Contents ​

Constructors (1) | Methods (6)

Constructors ​

DictionaryTypeHandler`2 ​

csharp
DictionaryTypeHandler`2()

Methods ​

MethodSummary
SetValueSets the parameter value for a Dictionary. Converts Dictionary to JSON string for database storage....
ParseParses the database value to a Dictionary. Converts JSON string from database back to Dictionary....
GetType
ToString
Equals
GetHashCode

SetValue ​

Sets the parameter value for a Dictionary. Converts Dictionary to JSON string for database storage.

csharp
void SetValue(IDbDataParameter parameter, Dictionary{`0 value)

Parameters ​

  • parameter (IDbDataParameter) - The database parameter to set.
  • value (Dictionary{`0) - The Dictionary value to serialize.

Parse ​

Parses the database value to a Dictionary. Converts JSON string from database back to Dictionary.

csharp
Dictionary&lt;TKey, TValue&gt;? Parse(object value)

Parameters ​

  • value (object) - The database value to parse.

Returns ​

Type: Dictionary&lt;TKey, TValue&gt;?

The parsed Dictionary, or null if the value is null or DBNull.

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()