{"id":15409971,"url":"https://github.com/havendv/eventgenerator","last_synced_at":"2025-06-24T16:37:01.207Z","repository":{"id":46535727,"uuid":"515392741","full_name":"HavenDV/EventGenerator","owner":"HavenDV","description":"Generates events, OnEvent() methods and EventArgs classes","archived":false,"fork":false,"pushed_at":"2025-06-16T09:24:05.000Z","size":321,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T23:33:38.057Z","etag":null,"topics":["csharp","events","generator","source-generator"],"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/HavenDV.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,"zenodo":null},"funding":{"patreon":"havendv","ko_fi":"havendv","custom":["https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"]}},"created_at":"2022-07-19T01:20:56.000Z","updated_at":"2025-06-16T09:24:02.000Z","dependencies_parsed_at":"2025-02-03T09:32:57.021Z","dependency_job_id":"29f1918a-b40d-4ee6-be6a-86e365476637","html_url":"https://github.com/HavenDV/EventGenerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HavenDV/EventGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FEventGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FEventGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FEventGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FEventGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HavenDV","download_url":"https://codeload.github.com/HavenDV/EventGenerator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FEventGenerator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261715277,"owners_count":23198731,"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":["csharp","events","generator","source-generator"],"created_at":"2024-10-01T16:42:10.744Z","updated_at":"2025-06-24T16:37:01.182Z","avatar_url":"https://github.com/HavenDV.png","language":"C#","funding_links":["https://patreon.com/havendv","https://ko-fi.com/havendv","https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"],"categories":[],"sub_categories":[],"readme":"# EventGenerator\nGenerates events, `OnEvent()` and `IDisposable SubscribeToEventName(handler)` methods. Can generate complex EventArgs from multi-type attributes.\n\n## Install\n```\nInstall-Package EventGenerator.Generator\n```\n```xml\n\u003c!-- compile asset is required for attributes. --\u003e\n\u003c!-- ExcludeAssets=\"runtime\" excludes EventGenerator.Attributes.dll from your output. --\u003e\n\u003cPackageReference Include=\"EventGenerator.Generator\" Version=\"0.3.3\" PrivateAssets=\"all\" ExcludeAssets=\"runtime\" /\u003e\n```\n\n## Usage\n```cs\n[Event\u003cstring, string\u003e(\"DataChanged\", PropertyNames = new [] { \"Title\", \"Namespace\" })]\npublic partial class MyClass\n{\n}\n```\nwill generate:\n```csharp\n//HintName: MyClass.Events.DataChanged.generated.cs\n#nullable enable\n\nnamespace H.Generators.IntegrationTests\n{\n    public partial class MyClass\n    {\n        /// \u003csummary\u003e\n        /// \u003c/summary\u003e\n        public event global::System.EventHandler\u003cglobal::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs\u003e? DataChanged;\n\n        /// \u003csummary\u003e\n        /// A helper method to subscribe to the DataChanged event.\n        /// \u003c/summary\u003e\n        public global::System.IDisposable SubscribeToDataChanged(global::System.EventHandler\u003cglobal::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs\u003e handler)\n        {\n            DataChanged += handler;\n\n            return new global::EventGenerator.Disposable(() =\u003e DataChanged -= handler);\n        }\n\n        /// \u003csummary\u003e\n        /// A helper method to raise the DataChanged event.\n        /// \u003c/summary\u003e\n        protected virtual global::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs OnDataChanged(global::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs args)\n        {\n            DataChanged?.Invoke(this, args);\n\n            return args;\n        }\n\n        /// \u003csummary\u003e\n        /// A helper method to raise the DataChanged event.\n        /// \u003c/summary\u003e\n        protected virtual global::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs OnDataChanged(\n            string title,\n            string @namespace)\n        {\n            var args = new global::H.Generators.IntegrationTests.MyClass.DataChangedEventArgs(title, @namespace);\n            DataChanged?.Invoke(this, args);\n\n            return args;\n        }\n    }\n}\n```\n```csharp\n//HintName: MyClass.EventArgs.DataChangedEventArgs.generated.cs\n#nullable enable\n\nnamespace H.Generators.IntegrationTests\n{\n    public partial class MyClass\n    {\n        /// \u003csummary\u003e\n        /// \n        /// \u003c/summary\u003e\n        public class DataChangedEventArgs : global::System.EventArgs\n        {\n            /// \u003csummary\u003e\n            /// \n            /// \u003c/summary\u003e\n            public string Title { get; }\n\n            /// \u003csummary\u003e\n            /// \n            /// \u003c/summary\u003e\n            public string Namespace { get; }\n\n            /// \u003csummary\u003e\n            /// \n            /// \u003c/summary\u003e\n            public DataChangedEventArgs(string title, string @namespace)\n            {\n                Title = title;\n                Namespace = @namespace;\n            }\n\n            /// \u003csummary\u003e\n            /// \n            /// \u003c/summary\u003e\n            public void Deconstruct(out string title, out string @namespace)\n            {\n                title = Title;\n                @namespace = Namespace;\n            }\n\n            /// \u003csummary\u003e\n            /// \n            /// \u003c/summary\u003e\n            public override string ToString()\n            {\n                return $\"(Title={Title}, Namespace={Namespace})\";\n            }\n        }\n    }\n}\n```\n\n## Open questions\n- Should we use EventArgs for the single type case? This is useful, for example, \nif the type of the Cancel property is bool, which allows you to tell the calling code to cancel something.\n- Should we always generate EventArgs or allow Action delegates to be used for these cases?\n\n## Notes\nTo use generic attributes, you need to set up `LangVersion` in your .csproj:\n```xml\n\u003cLangVersion\u003elatest\u003c/LangVersion\u003e\n```\nThere are also non-Generic attributes here.\n\n## Support\nPriority place for bugs: https://github.com/HavenDV/EventGenerator/issues  \nPriority place for ideas and general questions: https://github.com/HavenDV/EventGenerator/discussions  \nI also have a Discord support channel:  \nhttps://discord.gg/g8u2t9dKgE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavendv%2Feventgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhavendv%2Feventgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavendv%2Feventgenerator/lists"}