public void Swap <T>(ref T v1, ref T v2) { var genericArgumentT = GenericArgumentInfo.Create(typeof(T), nameof(T)); var invocationInfo = InvocationInfo.Create( typeof(RefUtilsAopProxy), nameof(Swap), new[] { ArgumentInfo.Create(typeof(T), nameof(v1), v1, ArgumentSpecialType.Ref, genericArgumentT), ArgumentInfo.Create(typeof(T), nameof(v2), v2, ArgumentSpecialType.Ref, genericArgumentT) }, new[] { genericArgumentT }, Swap <T>); var result = _interceptionHandler.Invoke(invocationInfo); const int v1Index = 0; const int v2Index = 1; v1 = (T)result.Arguments[v1Index].Value; v2 = (T)result.Arguments[v2Index].Value; }
public void DoSomethingInternal() { var invocationInfo = InvocationInfo.Create( typeof(InternalInterfaceAopProxy), nameof(DoSomethingInternal), DoSomethingInternal); _interceptionHandler.Invoke(invocationInfo); }
public void Dispose() { var invocationInfo = InvocationInfo.Create( typeof(AppConfigPeriodicRefreshHandlerAopProxy), nameof(Dispose), Dispose); _interceptionHandler.Invoke(invocationInfo); }
public void Start() { var invocationInfo = InvocationInfo.Create( typeof(AppConfigPeriodicRefreshHandlerAopProxy), nameof(Start), Start); _interceptionHandler.Invoke(invocationInfo); }
//TODO do we need a link to IDisposable interface? public void Dispose() { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(Dispose), Dispose); _interceptionHandler.Invoke(invocationInfo); }
public void SetDictionary(Dictionary <string, string> dict) { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(DoSomething), new[] { ArgumentInfo.Create(typeof(Dictionary <string, string>), nameof(dict), dict) }, SetDictionary); _interceptionHandler.Invoke(invocationInfo); }
public void DoSomething(List <IEnumerable <string> > list) { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(DoSomething), new[] { ArgumentInfo.Create(typeof(List <IEnumerable <string> >), nameof(list), list) }, DoSomethingListOfIEnumerableOfString); _interceptionHandler.Invoke(invocationInfo); }
public void DoSomething(string[] array) { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(DoSomething), new[] { ArgumentInfo.Create(typeof(string[]), nameof(array), array) }, DoSomethingArrayOfString); _interceptionHandler.Invoke(invocationInfo); }
public TA GetY() { var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(GetY), GenericArgumentInfo.EmptyArray, _classGenericArguments, ResultInfo.Create(typeof(TA), _classGenericArgumentTa), GetY); var result = _interceptionHandler.Invoke(invocationInfo); return((TA)result.Result.Value); }
public void DoSomething(string s, int x) { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(DoSomething), new[] { ArgumentInfo.Create(typeof(string), nameof(s), s), ArgumentInfo.Create(typeof(int), nameof(x), x) }, DoSomethingStringInt32); _interceptionHandler.Invoke(invocationInfo); }
public Task <List <int> > DoSomething(int parameter) { var invocationInfo = InvocationInfo.Create( typeof(TestInterfaceAopProxy), nameof(DoSomething), new[] { ArgumentInfo.Create(typeof(int), nameof(parameter), parameter) }, ResultInfo.Create(typeof(Task <List <int> >)), DoSomethingInt32); var result = _interceptionHandler.Invoke(invocationInfo); return((Task <List <int> >)result.Result.Value); }
public List <T> GetGenericList <T>() { var genericArgumentT = GenericArgumentInfo.Create(typeof(T), nameof(T)); var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(GetGenericList), new[] { genericArgumentT }, ResultInfo.Create(typeof(List <T>), genericArgumentT), GetGenericList <T>); var result = _interceptionHandler.Invoke(invocationInfo); return((List <T>)result.Result.Value); }
public long GetContactPhoneNumber(string firstName, string lastName) { var invocationInfo = InvocationInfo.Create( typeof(PhoneBookAopProxy), nameof(GetContactPhoneNumber), new[] { ArgumentInfo.Create(typeof (string), nameof(firstName), firstName), ArgumentInfo.Create(typeof (string), nameof(lastName), lastName) }, ResultInfo.Create(typeof(long)), GetContactPhoneNumber); var result = _interceptionHandler.Invoke(invocationInfo); return (long)result.Result.Value; }
public void SetGenericValue <T>(T value) { var genericArgumentT = GenericArgumentInfo.Create(typeof(T), nameof(T)); var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(GetGenericList), new[] { ArgumentInfo.Create(typeof(T), nameof(value), value, genericArgumentT), }, new[] { genericArgumentT }, SetGenericValue <T>); _interceptionHandler.Invoke(invocationInfo); }
public void SetElement <T>(int index, T value) { var genericArgumentT = GenericArgumentInfo.Create(typeof(T), nameof(T)); var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(SetElement), new[] { ArgumentInfo.Create(typeof(int), nameof(index), index), ArgumentInfo.Create(typeof(T), nameof(value), value, genericArgumentT) }, new[] { genericArgumentT }, SetElement <T>); _interceptionHandler.Invoke(invocationInfo); }
public bool GetElement(int index, out object value) { var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(GetElement), new[] { ArgumentInfo.Create(typeof(int), nameof(index), index), ArgumentInfo.Create(typeof(object), nameof(value), default(object), ArgumentSpecialType.Out) }, ResultInfo.Create(typeof(bool)), GetElement); var result = _interceptionHandler.Invoke(invocationInfo); const int valueIndex = 1; value = result.Arguments[valueIndex].Value; return((bool)result.Result.Value); }
public T GetBar <T>() where T : struct { var genericArgumentT = GenericArgumentInfo.Create( typeof(T), nameof(T), new[] { GenericArgumentRestriction.Create(GenericArgumentRestrictionType.Struct) }); var invocationInfo = InvocationInfo.Create( typeof(InterfaceWithGenericMethodAopProxy), nameof(GetBar), new[] { genericArgumentT }, ResultInfo.Create(typeof(T), genericArgumentT), GetBar <T>); var result = _interceptionHandler.Invoke(invocationInfo); return((T)result.Result.Value); }
public T GetElement <T>(int index) { var genericArgumentT = GenericArgumentInfo.Create(typeof(T), nameof(T)); var invocationInfo = InvocationInfo.Create( typeof(ContainerAopProxy), nameof(GetElement), new[] { ArgumentInfo.Create(typeof(int), nameof(index), index, genericArgumentT) }, new[] { genericArgumentT }, ResultInfo.Create(typeof(T), genericArgumentT), GetElement <T>); var result = _interceptionHandler.Invoke(invocationInfo); return((T)result.Result.Value); }
public void SetBoo <T, TA>(T t, TA a) where T : class, IDisposable, new() where TA : new() { var genericArgumentT = GenericArgumentInfo.Create( typeof(T), nameof(T), new[] { GenericArgumentRestriction.Create(GenericArgumentRestrictionType.Class), GenericArgumentRestriction.Create(typeof(IDisposable)), GenericArgumentRestriction.Create(GenericArgumentRestrictionType.New) }); var genericArgumentTa = GenericArgumentInfo.Create( typeof(TA), nameof(TA), new[] { GenericArgumentRestriction.Create(GenericArgumentRestrictionType.New) }); var invocationInfo = InvocationInfo.Create( typeof(InterfaceWithGenericMethodAopProxy), nameof(GetBar), new[] { ArgumentInfo.Create(typeof(T), nameof(t), t, genericArgumentT), ArgumentInfo.Create(typeof(TA), nameof(a), a, genericArgumentTa), }, new[] { genericArgumentT, genericArgumentTa }, SetBoo <T, TA>); _interceptionHandler.Invoke(invocationInfo); }