-
Notifications
You must be signed in to change notification settings - Fork 43
/
IBindingContext.cs
92 lines (77 loc) · 3.09 KB
/
IBindingContext.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections.Generic;
using System.Reflection;
using FubuCore.Binding.InMemory;
namespace FubuCore.Binding
{
/// <summary>
/// BindingContext represents the state of model binding as well
/// as providing some common functionality
/// </summary>
public interface IBindingContext
{
/// <summary>
/// Expose logging to the model binding subsystem
/// </summary>
IBindingLogger Logger { get; }
/// <summary>
/// List of all data conversion errors encountered during
/// a model binding operation
/// </summary>
IList<ConvertProblem> Problems { get; }
/// <summary>
/// Performs the binding action against the Property. Note: this
/// method is no longer tied to the existence of a data field in the
/// IRequestData that matches the property
/// </summary>
/// <param name="property"></param>
/// <param name="action"></param>
void ForProperty(PropertyInfo property, Action<IPropertyContext> action);
/// <summary>
/// CPS method to "tell" the IBindingContext what the current target of
/// model binding is.
/// </summary>
/// <param name="object"></param>
/// <param name="action"></param>
void ForObject(object @object, Action action);
/// <summary>
/// Binds an object of the requested type to the IRequestData. Use this
/// as a helper method to bind nested objects and collection objects
/// </summary>
/// <param name="data"></param>
/// <param name="type"></param>
/// <param name="continuation"></param>
/// <returns></returns>
void BindObject(IRequestData data, Type type, Action<object> continuation);
void BindObject(Type type, Action<object> continuation);
/// <summary>
/// Binds property values to an existing object
/// </summary>
/// <param name="instance"></param>
void BindProperties(object instance);
IEnumerable<IRequestData> GetEnumerableRequests(string name);
[MarkedForTermination("No usages in FubuCore - dru")]
IRequestData GetSubRequest(string name);
IBindingContext GetSubContext(string name);
/// <summary>
/// The current object being bound
/// </summary>
object Object { get; }
/// <summary>
/// Service locator method to the IoC container for the current request
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
T Service<T>();
/// <summary>
/// Shortcut to get converted data from the raw request by name
/// </summary>
IContextValues Data { get; }
/// <summary>
/// Tests whether or not the underlying data has a child request
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
bool HasChildRequest(string name);
}
}