9using System.Collections.Generic;
10using System.ComponentModel;
13using System.Reflection;
14using System.Threading.Tasks;
23 internal class AsyncLoader<T> : IAsyncLoader
26 private readonly Delegate _factory;
27 private readonly
object[] _parameters;
31 get {
return _property; }
37 params
object[] parameters)
41 _parameters = parameters;
44 public void Load(Action<IAsyncLoader, IDataPortalResult> callback)
46 var parameters =
new List<object>();
47 if (_parameters.Any())
48 parameters.Add(_parameters.First());
50 var myCallback =
new EventHandler<DataPortalResult<T>>((sender, result) => callback(
this, result));
51 parameters.Add(myCallback);
52 _factory.DynamicInvoke(parameters.ToArray());
Maintains metadata about a property.