{"id":20683088,"url":"https://github.com/puresharper/cneptune","last_synced_at":"2025-04-22T12:21:18.808Z","repository":{"id":144155729,"uuid":"78741538","full_name":"Puresharper/CNeptune","owner":"Puresharper","description":"CNeptune improve productivity \u0026 efficiency by urbanize .net module with meta-code to lay foundation for frameworks","archived":false,"fork":false,"pushed_at":"2018-04-26T20:46:19.000Z","size":56,"stargazers_count":31,"open_issues_count":12,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-17T11:53:50.729Z","etag":null,"topics":["aop","architecture","aspect-oriented-programming","cil","container","cross-cutting-concerns","dependency","design","di","efficiency","injection","interception","inversion-of-control","ioc","mock","mocking","pattern","productivity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Puresharper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-01-12T12:04:17.000Z","updated_at":"2022-12-10T20:41:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"53bfd0b2-a118-4aaf-849a-62fe7aafba27","html_url":"https://github.com/Puresharper/CNeptune","commit_stats":null,"previous_names":["virtuoze/cneptune"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Puresharper%2FCNeptune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Puresharper%2FCNeptune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Puresharper%2FCNeptune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Puresharper%2FCNeptune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Puresharper","download_url":"https://codeload.github.com/Puresharper/CNeptune/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237851,"owners_count":21397403,"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":["aop","architecture","aspect-oriented-programming","cil","container","cross-cutting-concerns","dependency","design","di","efficiency","injection","interception","inversion-of-control","ioc","mock","mocking","pattern","productivity"],"created_at":"2024-11-16T22:15:28.456Z","updated_at":"2025-04-22T12:21:18.784Z","avatar_url":"https://github.com/Puresharper.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/cneptune.svg)](https://www.nuget.org/packages/CNeptune)\n# CNeptune\n\nCNeptune is an util based on mono.cecil to rewrite .net assembly to inject all the needs to control execution flow in order to help architects to build a productive and efficient architecture.\n\n## Features\n- Dynamic : change method behavior at runtime\n- Efficient : injected mechanism is extremely efficient\n- Limitless : support all type of methods (constructors included)\n- Transparent : client side perception is not affected\n\n## Coverage\n- Aspect-Oriented Programming\n- Code contract / Data validation\n- Uncoupling technical concern\n- Diagnostics \u0026 measures\n- Mocking \u0026 tests\n- Simplify existing design pattern\n\n## Example of injection\n- Rewrite .net assembly by specifying path\n```\nneptune.exe \"C:\\...\\Assembly.dll\"\n```\n- Rewrite .net assembly by specifying project and configuration\n```\nneptune.exe \"C:\\...\\Project.csproj\" \"Debug\"\n```\n- Rewrite is automatically done after build and before link by adding CNeptune nuget package : https://www.nuget.org/packages/CNeptune\n```\nPM\u003e Install-Package CNeptune\n```\n\n## Example of usage\n- Override method at runtime\n\nBusiness\n```\npublic class Calculator\n{\n    public int Add(int a, int b)\n    {\n        return a + b;\n    }\n}\n```\n\nObtain the delegate to manage a method of 'Calculator'\n```\nvar _update = typeof(Calculator).GetNestedType(\"\u003cNeptune\u003e\", BindingFlags.NonPublic).GetField(\"\u003cUpdate\u003e\").GetValue(null) as Action\u003cMethodBase, Func\u003cMethodInfo, MethodInfo\u003e\u003e;\n```\n\nDefine 'Add' method to inject a console 'Hello World' before call.\n```\n_update\n(\n    typeof(Calculator).GetMethod(\"Add\"),\n    _Method =\u003e\n    {\n        var _method = new DynamicMethod(string.Empty, typeof(int), new Type[] { typeof(Calculator), typeof(int), typeof(int) }, typeof(Calculator), true);\n        var _body = _method.GetILGenerator();\n        _body.EmitWriteLine(\"Hello World\");\n        _body.Emit(OpCodes.Ldarg_0); //this\n        _body.Emit(OpCodes.Ldarg_1); //a\n        _body.Emit(OpCodes.Ldarg_2); //b\n        _body.Emit(OpCodes.Call, _Method);\n        _body.Emit(OpCodes.Ret);\n        return _method;\n    }\n);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuresharper%2Fcneptune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuresharper%2Fcneptune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuresharper%2Fcneptune/lists"}