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
| Method | Summary |
|---|---|
| SetValue | Sets the parameter value for a Dictionary. Converts Dictionary to JSON string for database storage.... |
| Parse | Parses 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<TKey, TValue>? Parse(object value)Parameters
- value (object) - The database value to parse.
Returns
Type: Dictionary<TKey, TValue>?
The parsed Dictionary, or null if the value is null or DBNull.
GetType
csharp
GetType()ToString
csharp
ToString()Equals
csharp
Equals()GetHashCode
csharp
GetHashCode()