public static TResult Invoke <TKey, TResult, TParam, TParam2>(this IMarkedExtendable obj, TKey key, TParam param, TParam2 param2) { TResult result = default(TResult); InvokeOnMap(() => result = (TResult)AttributeMap().Invoke(obj, key, param, param2), obj, key, typeof(TResult), param, param2); return(result); }
static void InvokeOnMap(Action _do, IMarkedExtendable obj, object key, Type returnType, params object[] parameters) { if (AttributeMap().CanInvoke(obj, key, returnType, parameters)) { _do(); } else if (!ObjectExtenderConfig.IgnoreException) { Throw(obj, key); } }
public static void RegisterAsyncAction <TKey, TParam, TParam2>(this IMarkedExtendable obj, TKey key, Func <TParam, TParam2, Task> func) => throw new NotImplementedException();
public static void RegisterFuncAsync <TKey, TResult, TParam>(this IMarkedExtendable obj, TKey key, Func <TParam, Task <TResult> > func) => throw new NotImplementedException();
public static Task <TResult> InvokeAsync <TKey, TResult, TParam, TParam2>(this IMarkedExtendable obj, TKey key, TParam param, TParam2 param2) => throw new NotImplementedException();
public static Task CallAsync <TKey, TParam>(this IMarkedExtendable obj, TKey key, TParam param) => throw new NotImplementedException();
static void Throw(IMarkedExtendable obj, object key) => throw new AttributeNotFoundException(obj.GetType(), key);
public static void Call <TKey, TParam, TParam2>(this IMarkedExtendable obj, TKey key, TParam param, TParam2 param2) { var args = new object[] { param, param2 }; InvokeOnMap(() => AttributeMap().Invoke(obj, key, args), obj, key, null, args); }
public static void Call <TKey>(this IMarkedExtendable obj, TKey key) { var args = new IMarkedExtendable[] { }; InvokeOnMap(() => AttributeMap().Invoke(obj, key, args), obj, key, null, args); }