Code Monkey home page Code Monkey logo

Comments (4)

pamidur avatar pamidur commented on August 16, 2024

That could work if those tag(s) would be persistent within the call. It can be done by introdusing something like additional local variables. Though it won't be thread-safe. (additional locks is evil).

In the next release we're introdusing the following feature:

        public class TestClass
        {
            [Aspect(typeof(TestAspectImplementation))]
            public int Do123()
            {
                Thread.Sleep(1000);
            }
        }

        public class TestAspectImplementation
        {
            [Advice(InjectionPoints.Around, InjectionTargets.Method)]
            public object AroundMethod(
                [AdviceArgument(AdviceArgumentSource.Target)] Func<object[], object> target,
                [AdviceArgument(AdviceArgumentSource.Arguments)] object[] arguments)
            {
                //here goes stopwatch start
                var result = target(arguments);
                //here goes stopwatch stop
                return result;
            }
        }

from aspect-injector.

pairbit avatar pairbit commented on August 16, 2024

Great, I'll wait!

from aspect-injector.

pairbit avatar pairbit commented on August 16, 2024

Why do you think that it will not be thread-safe?

from aspect-injector.

pamidur avatar pamidur commented on August 16, 2024

Because we would set custom local variable on the same context as method. I can't guarantee you will get the same object you put into tag in case method is being executed two times in perallel. Unless I force lock the method.

from aspect-injector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.