Exemple #1
0
        public void Show(string name, int age)
        {
            var methodFeature = new MethodFeature()
            {
                MethodInfo       = ShowMethod,
                OriginalInstance = _person,
                Parameters       = new object[] { name, age }
            };

            var aspectDelegate = AspectFactory(_services);
            var contextFactory = new AspectContextFactory(_services);
            var context        = contextFactory.Create(methodFeature);

            aspectDelegate(context);
        }
Exemple #2
0
        public async Task <string?> BaiduAsync(string url)
        {
            var methodFeature = new MethodFeature()
            {
                MethodInfo       = ShowMethod,
                OriginalInstance = _person,
                Parameters       = new object?[] { url }
            };

            var aspectDelegate = AspectFactory(_services);
            var contextFactory = new AspectContextFactory(_services);
            var context        = contextFactory.Create(methodFeature);

            await aspectDelegate(context);

            return((string?)context.ReturnValue);
        }