-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
IChangeTypeProvider.cs
44 lines (42 loc) · 1.62 KB
/
IChangeTypeProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Diagnostics.CodeAnalysis;
#nullable enable
namespace HotChocolate.Utilities
{
/// <summary>
/// A <see cref="IChangeTypeProvider" /> is used by the type converter to create new converter.
/// Each <see cref="IChangeTypeProvider" /> can provide one ore multiple value converters.
/// </summary>
public interface IChangeTypeProvider
{
/// <summary>
/// Tries to create a converter that can convert a value that is of the
/// type <paramref name="source"/> to a value of the type <paramref name="target"/>.
/// If this type provider can only handle parts of the conversion it can refer back to the
/// root converter to ask other <see cref="IChangeTypeProvider"/> to provide the rest of
/// the type conversion.
/// </summary>
/// <param name="source">
/// The source type.
/// </param>
/// <param name="target">
/// The traget type.
/// </param>
/// <param name="root">
/// The root change type provider that has access to
/// all registered <see cref="IChangeTypeProvider"/>.
/// </param>
/// <param name="converter">
/// The converter that was produced by this instance.
/// </param>
/// <returns>
/// Returns a boolean indicating if this <see cref="IChangeTypeProvider"/> was able to
/// create a type converter.
/// </returns>
bool TryCreateConverter(
Type source,
Type target,
ChangeTypeProvider root,
[NotNullWhen(true)]out ChangeType? converter);
}
}