Skip to content

Commit 8bfbf9d

Browse files
committed
Remove section on TValue customization
This is for now an advanced corner use case.
1 parent 58ea63f commit 8bfbf9d

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

readme.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -233,39 +233,6 @@ Things to note at template expansion time:
233233
by anoother generator.
234234

235235

236-
You can also customize code generation for the `TValue`s used in your struct ids.
237-
For example, the support for automatically registering a generic `Dapper.SqlMapper.TypeHandler<T>`
238-
when a `TValue` implements both `IParsable<T>` and `IFormattable` is implemented as a
239-
so-called `TValue` template:
240-
241-
```csharp
242-
[TValue]
243-
file class TValue_TypeHandler : Dapper.SqlMapper.TypeHandler<TValue>
244-
{
245-
public override TValue Parse(object value) => TValue.Parse((string)value, null);
246-
247-
public override void SetValue(IDbDataParameter parameter, TValue value)
248-
{
249-
parameter.DbType = DbType.String;
250-
parameter.Value = value.ToString(null, null);
251-
}
252-
}
253-
254-
file partial struct TValue : IParsable<TValue>, IFormattable
255-
{
256-
public static TValue Parse(string s, IFormatProvider? provider) => throw new NotImplementedException();
257-
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out TValue result) => throw new NotImplementedException();
258-
public string ToString(string? format, IFormatProvider? formatProvider) => throw new NotImplementedException();
259-
}
260-
```
261-
262-
If you use use [Ulid](https://github.com/Cysharp/Ulid) as a value type in your struct ids,
263-
for example, the template will be applied since `Ulid` implements both `IParsable<T>` and
264-
`IFormattable`. The generated code will look like this:
265-
266-
```csharp
267-
268-
269236
<!-- #content -->
270237
<!-- #ci -->
271238

0 commit comments

Comments
 (0)