Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yasikovsky committed May 18, 2021
1 parent c574625 commit 44c34d5
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ It has integrated the following fixes and enhancements:
- Support for custom type handlers (https://github.com/ericdc1/Dapper.SimpleCRUD/pull/221) by CyrilB1531

They are added by using `SimpleCRUD.AddTypeHandler(type, handler);`

Example init:

Example init:

```c#
SimpleCRUD.AddTypeHandler(typeof(List<Guid>), new ListTypeHandler<Guid>());
```
```c#
SimpleCRUD.AddTypeHandler(typeof(List<Guid>), new ListTypeHandler<Guid>());
```

Example handler:
Example handler:

```c#
public class ListTypeHandler<T> : SqlMapper.TypeHandler<List<T>>
```c#
public class ListTypeHandler<T> : SqlMapper.TypeHandler<List<T>>
{
public override List<T> Parse(object value)
{
public override List<T> Parse(object value)
{
return ((T[]) value).ToList();
}

public override void SetValue(IDbDataParameter parameter, List<T> value)
{
parameter.Value = value.ToArray();
}
return ((T[]) value).ToList();
}
```

public override void SetValue(IDbDataParameter parameter, List<T> value)
{
parameter.Value = value.ToArray();
}
}
```

- Support for anonymous object conditions with arrays (https://github.com/ericdc1/Dapper.SimpleCRUD/pull/225) by Alexandr Parashin (SwopDaWoop)

Expand Down

0 comments on commit 44c34d5

Please sign in to comment.