-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update libraries and documentation (#214)
- Loading branch information
Showing
6 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# StringArrayTypeHandler Class | ||
|
||
A custom Dapper type handler for mapping arrays of strings to and from the database. | ||
|
||
### Usage | ||
|
||
This handler allows the conversion of a delimited string in the database to a string array in the application, and vice versa. A custom separator can be defined to split or join the string elements. | ||
|
||
```csharp | ||
StringArrayTypeHandler.Configure(";"); | ||
``` | ||
|
||
|
||
### `Parse(object value)` | ||
|
||
Converts a database value, expected to be a delimited string, into a `string[]`. | ||
|
||
#### Parameters | ||
- **`value`** (`object`): | ||
The database value to be parsed. It is expected to be a string containing multiple values separated by the specified separator. | ||
|
||
#### Returns | ||
- **`string[]`**: | ||
A array of strings obtained by splitting the input value based on the separator. Empty entries are removed from the result. | ||
|
||
### `SetValue(IDbDataParameter parameter, string[]? value)` | ||
|
||
The `SetValue` method converts an `string[]` array into a single delimited string, suitable for saving to the database, and assigns it to the given database parameter. | ||
|
||
#### Parameters | ||
- **`parameter`** (`IDbDataParameter `): | ||
The database parameter. | ||
|
||
- **`value`** (`string[]? value `): | ||
The string array of values | ||
|
||
#### Returns | ||
- **`void`**: | ||
|
||
### `Configure(string separator = ";")` | ||
Configures Dapper to use the `StringArrayTypeHandler` for handling string array mappings. Allows specifying a custom separator (default is `";"`). | ||
Should be called during application startup to ensure that Dapper is configured to correctly map arrays of strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# TimeOnlyTypeHandler Class | ||
|
||
A custom Dapper type handler for the `TimeOnly` struct, used to map database time values to `TimeOnly` in .NET 6.0 or greater. | ||
|
||
### Usage | ||
|
||
This class provides functionality to parse database time values into `TimeOnly` and to convert `TimeOnly` values to a format suitable for database storage. | ||
|
||
### `Parse(object value)` | ||
|
||
- Parses a database value to a `TimeOnly` object. | ||
|
||
#### Parameters | ||
- **`value`** (`object`): | ||
Takes a database value expected to be a time-based type and converts it to a `TimeOnly` representation. | ||
|
||
#### Returns | ||
- **TimeOnly**: | ||
Returns value converted to a `TimeOnly` Structure. | ||
|
||
### `SetValue(IDbDataParameter parameter, TimeOnly value)` | ||
|
||
- Sets the value of the database parameter to a `TimeOnly` converted to a `TimeSpan`.Configures the database parameter's type as `DbType.Time` to indicate that the value represents a time. | ||
|
||
#### Parameters | ||
- **`parameter`** (`IDbDataParameter `): | ||
The database parameter. | ||
|
||
- **`value`** (`IEnumerable<string> `): | ||
The TimeOnly value to be set | ||
|
||
#### Returns | ||
- **`void`**: | ||
|
||
### Configure Method | ||
- Configures Dapper to use the `TimeOnlyTypeHandler` for handling `TimeOnly` values. | ||
- Should be called during application startup to ensure that Dapper is correctly configured to map `TimeOnly` values to and from the database. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters