{"id":13655282,"url":"https://github.com/pamidur/aspect-injector","last_synced_at":"2025-05-13T21:09:25.611Z","repository":{"id":22072874,"uuid":"25402145","full_name":"pamidur/aspect-injector","owner":"pamidur","description":"AOP framework for .NET (c#, vb, etc)","archived":false,"fork":false,"pushed_at":"2024-12-01T06:32:43.000Z","size":13837,"stargazers_count":786,"open_issues_count":36,"forks_count":118,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-12T17:45:02.271Z","etag":null,"topics":["advice","aop","aop-framework","aot","aspect","aspects","attribute","attributes","blazor","c-sharp","compile-time","dotnet","dotnet-core","injection","inpc","mixin","mixins","postsharp","wrap","wrapper"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pamidur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-18T16:02:41.000Z","updated_at":"2025-03-27T08:07:04.000Z","dependencies_parsed_at":"2024-06-11T19:11:20.227Z","dependency_job_id":"a789f21a-edd5-4e00-aa0b-c2e8e7b479f6","html_url":"https://github.com/pamidur/aspect-injector","commit_stats":{"total_commits":605,"total_committers":14,"mean_commits":"43.214285714285715","dds":"0.19999999999999996","last_synced_commit":"2a4a154857f4389a96ff4a0421e97ff91e2e060d"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamidur%2Faspect-injector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamidur%2Faspect-injector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamidur%2Faspect-injector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamidur%2Faspect-injector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pamidur","download_url":"https://codeload.github.com/pamidur/aspect-injector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251326386,"owners_count":21571626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advice","aop","aop-framework","aot","aspect","aspects","attribute","attributes","blazor","c-sharp","compile-time","dotnet","dotnet-core","injection","inpc","mixin","mixins","postsharp","wrap","wrapper"],"created_at":"2024-08-02T03:01:01.524Z","updated_at":"2025-04-28T13:59:34.835Z","avatar_url":"https://github.com/pamidur.png","language":"C#","funding_links":[],"categories":["AOP (Aspect Oriented Programming)","C\\#"],"sub_categories":[],"readme":"![image](https://user-images.githubusercontent.com/4095184/155636545-94ba7c67-277f-46d7-84e3-b750ff341769.png)\n\n\u003ch3\u003e\u003cspan style=\"color: #ff0000;\"\u003e\u003cstrong\u003eI have never asked for any donations, but today, I ask you, please, consider donating Ukrainian Army.\u003cbr /\u003e\u003c/strong\u003e\u003c/span\u003e\u003c/h3\u003e\n\u003ch3\u003e\u003cspan style=\"color: #ff0000;\"\u003e\u003cstrong\u003eYou can find official ways to do it \u003ca href=\"https://bank.gov.ua/en/news/all/natsionalniy-bank-vidkriv-spetsrahunok-dlya-zboru-koshtiv-na-potrebi-armiyi\"\u003ehere\u003c/a\u003e or you can donate to the biggest charity organization \u003ca href=\"https://www.comebackalive.in.ua/\"\u003ehere\u003c/a\u003e\u003c/strong\u003e\u003c/span\u003e\u003c/h3\u003e\n\u003ch3\u003e\u003cspan style=\"color: #ff0000;\"\u003e\u003cstrong\u003ePeople need to be alive to create open source projects!\u003c/strong\u003e\u003c/span\u003e\u003c/h3\u003e\n\n\n\n \n \n_______________________________\n_______________________________\n_______________________________\n\n-------------------------------\n \n \n\n\u003cimg src=\"https://raw.githubusercontent.com/pamidur/aspect-injector/master/package.png\" width=\"48\" align=\"right\"/\u003eAspect Injector\n========================\n**Aspect Injector** is an attribute-based framework for creating and injecting aspects into your .net assemblies.\n\n### Project Status\n[![Nuget](https://img.shields.io/nuget/v/AspectInjector?label=stable\u0026logo=nuget\u0026style=flat-square)](https://www.nuget.org/packages/AspectInjector)\n[![Nuget Pre](https://img.shields.io/nuget/vpre/AspectInjector?label=latest\u0026logo=nuget\u0026style=flat-square)](https://www.nuget.org/packages/AspectInjector)\n[![Nuget](https://img.shields.io/nuget/dt/AspectInjector?style=flat-square)](https://www.nuget.org/packages/AspectInjector)\n\n![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/pamidur/aspect-injector?style=flat-square)\n![GitHub last commit](https://img.shields.io/github/last-commit/pamidur/aspect-injector?style=flat-square)\n\n[![Application Status](https://img.shields.io/github/actions/workflow/status/pamidur/aspect-injector/application.yml?label=app%20build\u0026style=flat-square)](https://github.com/pamidur/aspect-injector/commits/master)\n\n### Download\n```bash\n\u003e dotnet add package AspectInjector\n```\n\n### Features\n- Compile-time injection - works with Blazor and AOT\n- Injecting **Before**, **After** and **Around** (wrap) **Methods**, **Constructors**, **Properties** and **Events**\n- Injecting **Interface implementations**\n- Supports any project that can reference **netstandard2.0** libraries, see [here](https://docs.microsoft.com/en-us/dotnet/standard/net-standard)\n- Debugging support\n- Roslyn analyzers for your convenience (only c# currently)\n- Can work DI/IoC frameworks [#166](https://github.com/pamidur/aspect-injector/discussions/166)\n\nCheck out [samples](samples) and [docs](docs)\n\n### Requirements\n- (_semi-optional_) **Nuget 5.0+** for _transient build_ feature. All modern versions of VS and dotnetsdk have it. \n_(If you still use project.json for some reason - make sure you add AspectInjector to all projects in the solution)_\n- (_optional_) For analyzers to work in VSCode, don't forget to enable ```\"omnisharp.enableRoslynAnalyzers\": true``` \n\n### Known Issues / Limitations\n- Unsafe methods are not supported and are silently ignored.\n\n### Simple advice\n#### Create an aspect with simple advice:\n```C#\n[Aspect(Scope.Global)]\n[Injection(typeof(LogCall))]\npublic class LogCall : Attribute\n{\n    [Advice(Kind.Before)] // you can have also After (async-aware), and Around(Wrap/Instead) kinds\n    public void LogEnter([Argument(Source.Name)] string name)\n    {\n        Console.WriteLine($\"Calling '{name}' method...\");   //you can debug it\t\n    }\n}\n```\n#### Use it:\n```C#\n[LogCall]\npublic void Calculate() \n{ \n    Console.WriteLine(\"Calculated\");\n}\n\nCalculate();\n```\n#### Result:\n```bash\n$ dotnet run\nCalling 'Calculate' method...\nCalculated\n```\n\n\n### Simple mixin\n#### Create an aspect with mixin:\n```C#\npublic interface IInitializable\n{\n    void Init();\n}\n\n[Aspect(Scope.PerInstance)]\n[Injection(typeof(Initializable))]\n[Mixin(typeof(IInitializable))]\npublic class Initializable : IInitializable, Attribute\n{\n    public void Init()\n    {\n        Console.WriteLine(\"Initialized!\");\n    }\n}\n```\n#### Use it:\n```C#\n[Initializable]\npublic class Target\n{ \n}\n\nvar target = new Target() as IInitializable;\ntarget.Init();\n```\n#### Result:\n```bash\n$ dotnet run\nInitialized!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamidur%2Faspect-injector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpamidur%2Faspect-injector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamidur%2Faspect-injector/lists"}