Aspectus is an advanced Aspect-Oriented Programming (AOP) library that simplifies the injection of cross-cutting concerns into your codebase. It empowers you to write clean and maintainable code by separating cross-cutting concerns from the core logic of your application.
$ dotnet add package AspectusAspectus is an advanced Aspect-Oriented Programming (AOP) library that simplifies the injection of cross-cutting concerns into your codebase. It empowers you to write clean and maintainable code by separating cross-cutting concerns from the core logic of your application.
IAspect interface to define custom logic for constructors, methods, and exception handling.To install Aspectus, use the NuGet package manager:
Install-Package Aspectus
Follow these steps to start using Aspectus in your project:
Register Aspectus with your IoC container during startup. Example code:
ServiceProvider? ServiceProvider = new ServiceCollection().RegisterAspectus()?.BuildServiceProvider();
or
ServiceProvider? ServiceProvider = new ServiceCollection().AddCanisterModules()?.BuildServiceProvider();
As the library supports Canister Modules.
Implement aspects by creating classes that inherit from the IAspect interface. Customize aspects based on your specific requirements, such as constructor setups, method injections, and exception handling.
public class TestAspect : IAspect
{
// Implement your aspect logic here
}
Utilize Aspectus to create instances of types with injected aspects.
var aspectus = ServiceProvider.GetRequiredService<Aspectus>();
aspectus.Setup(typeof(YourClass));
var item = aspectus.Create<YourClass>();
// Use and enjoy your enhanced object
For a more detailed guide on using Aspectus, including advanced scenarios and AOP modules, refer to the Aspectus Documentation.
To build Aspectus from source, ensure you have the following:
Simply clone the repository and open the solution in Visual Studio.
Contributions are welcome! To contribute to Aspectus, please follow these steps:
git checkout -b feature/YourFeature.git commit -am 'Add YourFeature'.git push origin feature/YourFeature.Please ensure your code follows the existing coding style and includes appropriate tests. Additionally, make sure to update the documentation as needed.