2using System.Collections.Generic;
5using System.Threading.Tasks;
10 internal class TaskDataPortalResult : IDataPortalResult
12 public object Object {
get;
internal set; }
13 public Exception
Error {
get;
internal set; }
14 public object UserState {
get;
internal set; }
20 internal class TaskLoader<T> : IAsyncLoader
22 private readonly Task<T> _loader;
23 public IPropertyInfo Property {
get;
private set; }
25 public TaskLoader(IPropertyInfo property, Task<T> loader)
31 public async
void Load(Action<IAsyncLoader, IDataPortalResult> callback)
33 TaskDataPortalResult result;
36 var o = await _loader;
37 result =
new TaskDataPortalResult() {
Error =
null, Object = o };
41 result =
new TaskDataPortalResult() {
Error = ex, Object =
null };
44 callback(
this, result);
@ Error
Represents a serious business rule violation that should cause an object to be considered invalid.