{"id":13628898,"url":"https://github.com/trympet/ThisClass","last_synced_at":"2025-04-17T04:32:33.246Z","repository":{"id":131303814,"uuid":"387807199","full_name":"trympet/ThisClass","owner":"trympet","description":"Exposes class and type information as constants in the ThisClass class using source generators powered by Roslyn, inspired by ThisAssembly.","archived":false,"fork":false,"pushed_at":"2024-04-14T12:00:03.000Z","size":82,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T10:12:09.415Z","etag":null,"topics":["csharp-sourcegenerator","reflection-free","roslyn-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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trympet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-07-20T13:50:49.000Z","updated_at":"2024-12-03T01:05:49.000Z","dependencies_parsed_at":"2024-04-14T12:43:17.644Z","dependency_job_id":null,"html_url":"https://github.com/trympet/ThisClass","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trympet%2FThisClass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trympet%2FThisClass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trympet%2FThisClass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trympet%2FThisClass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trympet","download_url":"https://codeload.github.com/trympet/ThisClass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248956273,"owners_count":21189322,"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-sourcegenerator","reflection-free","roslyn-generator","source-generator"],"created_at":"2024-08-01T22:00:59.158Z","updated_at":"2025-04-17T04:32:31.464Z","avatar_url":"https://github.com/trympet.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["139. [ThisClass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisClass) , in the [EnhancementClass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementclass) category"],"readme":"# ThisClass\nExposes class and type information as constants in the ThisClass class using source generators powered by Roslyn, inspired by ThisAssembly.\n\n## ThisClass\nAdd the `ThisClassAttribute` to generate type information for a class.\n```csharp\n[ThisClass]\npartial class Demo\n{\n    public Demo()\n    {\n        Logger.Info($\"Hello from {ThisClass.FullName}\"); // SampleApp.Demo\n    }\n}\n```\n\n\n## NLog.Extensions.ThisClass\nCreate class loggers without using reflection.\n```csharp\nusing SomeNamespace;\n\nnamespace SampleApp.NLog\n{\n    ...\n    namespace AnotherNamespace\n    {\n        using SomeOtherNamespace;\n        [ClassLoggerLazy]\n        partial class Demo2\u003cT\u003e : SomeInterface\u003cT\u003e where T : SomeOtherInterface\n        {\n            public static void SayHello()\n            {\n                Logger.Info(\"Hello\");\n            }\n\n            [ClassLogger]\n            internal partial class NestedClass : SomeInterface\u003cSomeOtherInterface\u003e\n            {\n            }\n        }\n    }\n}\n```\n\nLooks like this behind the scenes\n```csharp\n// \u003cauto-generated/\u003e\n#nullable enable\nnamespace SampleApp.NLog\n{\n    partial class Demo1\n    {\n        public static partial class ThisClass\n        {\n            /// \u003csummary\u003e\n            /// Gets the fully qualified name of the parent class, including the namespace but not the assembly.\n            /// \u003c/summary\u003e\n            public const string FullName = \"SampleApp.NLog.Demo1\";\n        }\n    }\n}\n\n// \u003cauto-generated/\u003e\n#nullable enable\nnamespace SampleApp.NLog\n{\n    namespace AnotherNamespace\n    {\n        using SomeOtherNamespace;\n\n        partial class Demo2\u003cT\u003e : global::SomeNamespace.SomeInterface\u003cT\u003e where T : global::SomeOtherNamespace.SomeOtherInterface\n        {\n            public static partial class ThisClass\n            {\n                /// \u003csummary\u003e\n                /// Gets the fully qualified name of the parent class, including the namespace but not the assembly.\n                /// \u003c/summary\u003e\n                public const string FullName = \"SampleApp.NLog.AnotherNamespace.Demo2\";\n            }\n\n            private static global::NLog.Logger? __loggerLazy;\n            private static global::NLog.Logger Logger =\u003e __loggerLazy ??= global::NLog.LogManager.GetLogger(ThisClass.FullName);\n        }\n    }\n}\n\n// \u003cauto-generated/\u003e\n#nullable enable\nnamespace SampleApp.NLog\n{\n    namespace AnotherNamespace\n    {\n        using SomeOtherNamespace;\n\n        partial class Demo2\u003cT\u003e : global::SomeNamespace.SomeInterface\u003cT\u003e where T : global::SomeOtherNamespace.SomeOtherInterface\n        {\n            partial class NestedClass : global::SomeNamespace.SomeInterface\u003cglobal::SomeOtherNamespace.SomeOtherInterface\u003e\n            {\n                public static partial class ThisClass\n                {\n                    /// \u003csummary\u003e\n                    /// Gets the fully qualified name of the parent class, including the namespace but not the assembly.\n                    /// \u003c/summary\u003e\n                    public const string FullName = \"SampleApp.NLog.AnotherNamespace.Demo2.NestedClass\";\n                }\n\n                private static readonly global::NLog.Logger Logger = global::NLog.LogManager.GetLogger(ThisClass.FullName);\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrympet%2FThisClass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrympet%2FThisClass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrympet%2FThisClass/lists"}