Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aspect oriented programming #6

Merged
merged 15 commits into from Jan 7, 2021

Conversation

yusufyilmazfr
Copy link
Owner

I seperated AOP modules from Asmin.Core to Asmin.Packages.AOP

Latest version depend Autofac IoC container for AOP and dependency injection. We don't need those. Project should doesn't couple another IoC container because .NET Core already provides this features.

I removed src/Asmin/Asmin.Business/DependencyModules/Autofac/AutofacDependencyModule.cs and I wrote IServiceCollection for each module dependencies.

If you want to use AOP modules, you can use default attributes such as; AsminExceptionAspect, AsminUnitOfWorkAspect. They provides simple features. If you want to change this behaviour you can create new attribute and extend this aspects.

namespace Asmin.Packages.AOP.Aspects.Exception
{
    /// <summary>
    /// CustomExceptionAspect works when method is throwing exception
    /// </summary>
    public class CustomExceptionAspect : AsminExceptionAspect
    {
        public override void OnException(IInvocation invocation, System.Exception exception)
        {
            base.OnException(invocation, exception);
        }
    }
}

on the other hand you can create new attribute and inherite MethodInterceptor.

/// <summary>
/// CustomAspect works when method finished successfully
/// </summary>
public class CustomAspect : MethodInterceptor
{
    public override void OnSuccess(IInvocation invocation)
    {
        base.OnSuccess(invocation);
    }
}

@yusufyilmazfr
Copy link
Owner Author

I found some methods for async invocation. I have added in this commit 1aeccea. I will check it later, i want to continue with current version.

@yusufyilmazfr yusufyilmazfr merged commit b8d5219 into asmin-new-features Jan 7, 2021
@yusufyilmazfr yusufyilmazfr deleted the aspect-oriented-programming branch January 7, 2021 18:24
@yusufyilmazfr yusufyilmazfr restored the aspect-oriented-programming branch January 7, 2021 18:28
@yusufyilmazfr yusufyilmazfr deleted the aspect-oriented-programming branch January 7, 2021 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant