-
Notifications
You must be signed in to change notification settings - Fork 1
/
IResourceResolver.cs
43 lines (39 loc) · 2.09 KB
/
IResourceResolver.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
using System;
using System.Threading.Tasks;
namespace JollyQuotes
{
/// <summary>
/// Provides a mechanism for resolving resources of type <c>T</c> from a specified, <see cref="string"/>-defined source.
/// </summary>
public interface IResourceResolver
{
/// <summary>
/// Resolves a resource of type <typeparamref name="T"/> using data found in the <paramref name="source"/>.
/// </summary>
/// <typeparam name="T">Type of resource to resolve.</typeparam>
/// <param name="source">Source of data used to resolve the resource.</param>
/// <exception cref="ArgumentException"><paramref name="source"/> is <see langword="null"/> or empty.</exception>
T Resolve<T>(string source);
/// <summary>
/// Asynchronously resolves a resource of type <typeparamref name="T"/> using data found in the <paramref name="source"/>.
/// </summary>
/// <typeparam name="T">Type of resource to resolve.</typeparam>
/// <param name="source">Source of data used to resolve the resource.</param>
/// <exception cref="ArgumentException"><paramref name="source"/> is <see langword="null"/> or empty.</exception>
Task<T> ResolveAsync<T>(string source);
/// <summary>
/// Attempts to resolve a resource of type <typeparamref name="T"/> using data found in the <paramref name="source"/>.
/// </summary>
/// <typeparam name="T">Type of resource to resolve.</typeparam>
/// <param name="source">Source of data used to resolve the resource.</param>
/// <exception cref="ArgumentException"><paramref name="source"/> is <see langword="null"/> or empty.</exception>
ResolverResponse<T> TryResolve<T>(string source);
/// <summary>
/// Attempts to asynchronously resolve a resource of type <typeparamref name="T"/> using data found in the <paramref name="source"/>.
/// </summary>
/// <typeparam name="T">Type of resource to resolve.</typeparam>
/// <param name="source">Source of data used to resolve the resource.</param>
/// <exception cref="ArgumentException"><paramref name="source"/> is <see langword="null"/> or empty.</exception>
Task<ResolverResponse<T>> TryResolveAsync<T>(string source);
}
}