{"id":23740215,"url":"https://github.com/mustaddon/dispatchproxyadvanced","last_synced_at":"2026-01-24T06:39:56.920Z","repository":{"id":62745970,"uuid":"562184304","full_name":"mustaddon/DispatchProxyAdvanced","owner":"mustaddon","description":"Extended version of DispatchProxy with Class proxying","archived":false,"fork":false,"pushed_at":"2024-11-16T09:01:58.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T01:52:42.129Z","etag":null,"topics":["custom-state","dispatch-proxy","dispatchproxy","dotnet","proxy-class","proxy-factory","proxy-handler","proxy-interface","proxy-object","proxy-objects"],"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/mustaddon.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":"2022-11-05T15:09:18.000Z","updated_at":"2024-11-16T09:02:02.000Z","dependencies_parsed_at":"2024-10-25T14:40:01.729Z","dependency_job_id":"6fef30dd-c88f-4a83-b576-cefb7f3bab11","html_url":"https://github.com/mustaddon/DispatchProxyAdvanced","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"cb01dad4c3e72b89f62976e87aaeb23ac879723b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDispatchProxyAdvanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDispatchProxyAdvanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDispatchProxyAdvanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDispatchProxyAdvanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustaddon","download_url":"https://codeload.github.com/mustaddon/DispatchProxyAdvanced/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231970943,"owners_count":18453930,"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":["custom-state","dispatch-proxy","dispatchproxy","dotnet","proxy-class","proxy-factory","proxy-handler","proxy-interface","proxy-object","proxy-objects"],"created_at":"2024-12-31T09:47:29.602Z","updated_at":"2026-01-24T06:39:56.862Z","avatar_url":"https://github.com/mustaddon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DispatchProxyAdvanced [![NuGet version](https://badge.fury.io/nu/DispatchProxyAdvanced.svg?208)](http://badge.fury.io/nu/DispatchProxyAdvanced)\nExtended version of DispatchProxy with Class proxying and custom states.\n\n\n### Example 1: Interface proxing\n```C#\ninterface IExampleInterface\n{\n    int MyProp { get; set; }\n    int MyMethod(int a, int b);\n}\n```\n\n```C#\nusing DispatchProxyAdvanced;\n\nvar proxy1 = ProxyFactory.Create\u003cIExampleInterface\u003e((method, args) =\u003e\n{\n    Console.WriteLine($\"Executing method: {method.Name}, with args: {string.Join(\", \", args)}\");\n    return args.FirstOrDefault();\n});\n\nproxy1.MyProp = 222;\nproxy1.MyMethod(20, 200);\n\n// Console output: \n// Executing method: set_MyProp, with args: 222\n// Executing method: MyMethod, with args: 20, 200\n```\n\n\n### Example 2: Class proxing with source instance\n```C#\nclass ExampleClass\n{\n    public virtual int MyProp { get; set; }\n    public virtual int MyMethod(int a, int b) =\u003e a * b;\n}\n```\n```C#\nvar someInstance = new ExampleClass { MyProp = 111 };\n\nvar proxy3 = ProxyFactory.CreateSourced(someInstance, (source, method, args) =\u003e\n{\n    Console.WriteLine($\"Executing method: {method.Name}, with args: {string.Join(\", \", args)}\");\n    return method.Invoke(source, args);\n});\n\nConsole.WriteLine($\"Property value: {proxy3.MyProp}\");\nConsole.WriteLine($\"Method result: {proxy3.MyMethod(10, 100)}\");\n\n// Console output: \n// Executing method: get_MyProp, with args:\n// Property value: 111\n// Executing method: MyMethod, with args: 10, 100\n// Method result: 1000\n```\n\n\n### Example 3: Custom proxy instance state\n```C#\nvar proxy4 = ProxyFactory.CreateSourced(someInstance, (source, proxy, method, args) =\u003e\n{\n    // set your custom state to proxy instance\n    proxy.CustomProxyStateDefinition = \"ExampleStateValue\";\n\n    Console.WriteLine($\"Executing method: {method.Name}\");\n    return method.Invoke(source, args);\n});\n\nConsole.WriteLine($\"Start proxy state: '{((IProxy)proxy4).CustomProxyStateDefinition}'\");\n\nproxy4.MyMethod(10, 100);\n\nConsole.WriteLine($\"Current proxy state: '{((IProxy)proxy4).CustomProxyStateDefinition}'\");\n\n// Console output: \n// Start proxy state: ''\n// Executing method: MyMethod\n// Current proxy state: 'ExampleStateValue'\n```\n\n[Program.cs](https://github.com/mustaddon/DispatchProxyAdvanced/tree/master/Examples/Program.cs)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Fdispatchproxyadvanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustaddon%2Fdispatchproxyadvanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Fdispatchproxyadvanced/lists"}