{"id":18339483,"url":"https://github.com/antelcat/autogen","last_synced_at":"2025-07-11T10:07:00.353Z","repository":{"id":211073163,"uuid":"728133807","full_name":"Antelcat/AutoGen","owner":"Antelcat","description":"Auto generate anything","archived":false,"fork":false,"pushed_at":"2025-07-08T14:32:56.000Z","size":1509,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T15:42:03.988Z","etag":null,"topics":["autogen","compile-time","extension","mapping","metadata","polyfill","roslyn","roslyn-generator","weaver"],"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/Antelcat.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}},"created_at":"2023-12-06T09:53:43.000Z","updated_at":"2025-07-08T14:32:59.000Z","dependencies_parsed_at":"2023-12-17T06:23:28.031Z","dependency_job_id":"817600c3-7fd0-40c3-b8db-7033f8848309","html_url":"https://github.com/Antelcat/AutoGen","commit_stats":null,"previous_names":["antelcat/antelcat.autogen","antelcat/autogen"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/Antelcat/AutoGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FAutoGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FAutoGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FAutoGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FAutoGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Antelcat","download_url":"https://codeload.github.com/Antelcat/AutoGen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Antelcat%2FAutoGen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264781030,"owners_count":23662776,"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":["autogen","compile-time","extension","mapping","metadata","polyfill","roslyn","roslyn-generator","weaver"],"created_at":"2024-11-05T20:18:00.514Z","updated_at":"2025-07-11T10:07:00.346Z","avatar_url":"https://github.com/Antelcat.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antelcat.AutoGen\n\n🇨🇳 [中文](./README.zh.md)\n\nAuto generate anything you may want\n\u003e ~~unless we can't~~\n\n## Supported\n\n### `Antelcat.AutoGen.ComponentModel` :  \n\n+ `Diagnostic`\n  + #### `[MetadataScript]`\n\n    Auto generate code executed by `Execute`\n\n    ![MetadataScript](./docs/MetadataScript.png)\n  \n  + #### `[AutoMetadataFrom(Type, MemberTypes)]` :\n  \n    Auto generate code using `Template` from target type members  \n\n    ![AutoMetadata](./docs/AutoMetadata.png)\n\n  + #### `[AutoTypeInference]` :\n  \n    Auto generate `Type` detected from `anonymous`object creation\n\n    ![AutoTypeInference](./docs/AutoTypeInference.png)\n\n  + #### `[RecordIgnore]` :\n    \n    Auto exclude member calculation in `GetHashCode` and `PrintMembers` of record\n\n+ #### `[AutoStringTo(string, Accessibility)]` :\n\n    Auto generate string To extension\n\n    only on `assembly` and `static partial class`\n\n    ![AutoStringTo](./docs/AutoStringTo.png)\n\n+ #### `Mapping` :  \n\n  + #### `[AutoMap(Accessibility)]` :  \n\n    Auto generate mappings between types\n\n    \u003e Only on `partial method`\n\n    ![AutoMapTo](./docs/AutoMap.png)\n\n    \u003e You can use to generate `shallow copy`\n\n  + #### `[MapBetween(fromProperty, toProperty)]` :  \n\n    Specify property mapping between types\n\n    + `By` : Method being called when mapping this property\n\n  + #### `[MapIgnore]` :  \n\n    To be ignored when generate mapping code\n\n  + #### `[MapInclude(property)]` :  \n\n    Explicit include properties when `[MapIgnore]`\n\n  + #### `[MapExclude(string)]` :  \n\n    To be excluded when mapping\n\n  + #### `[MapConstructor(params string[])]` :  \n\n    Specified property to be added in constructor, will auto-detect if `null`\n\n\n+ #### `[AutoFilePath]`:\n  \n  Auto generate `FilePath` which is `ref readonly struct`\n\n    ```csharp\n    void Fun([CallerFilePath] string path = \"\")\n    {\n        var directory       = (FilePath)path \u003c\u003c 1;\n        var full            = directory / \"Antelcat.AutoGen.Sample\" / \"Example.cs\";\n        var changeExtension = full - 2 + \".g.cs\";\n    }\n    ``` \n\n+ #### `[AutoDeconstructIndexable]`:\n\n  Auto generate `Deconstruct` method for `IList\u003c\u003e` and custom types\n\n    ```csharp\n    [assembly: AutoDeconstructIndexable(16/*default size is 16*/, typeof(Foo))]\n  \n    int[] list = [1,2,3];\n    var (a, b, c) = list;\n  \n    class Foo{\n        public object this[int index] =\u003e index;\n    }\n  \n    var (a, b, c, d) = new Foo();\n    ```\n\n+ #### `[AutoExtendFor]`:\n\n  Auto generate `this` extensions for `static` method in `static class`\n\n  ```csharp\n  class StaticClass\n  {\n      public static void Fun(int i) =\u003e Console.WriteLine(i);\n  }\n  \n  [AutoExtendFor(typeof(StaticClass))]\n  static partial class Extension;\n  \n  /// \u003cgenerated\u003e\n  static partial class Extension\n  {\n      public static void Fun(this int i) =\u003e StaticClass.Fun(i); // call original method\n  }\n\n+ #### `[AutoKeyAccessor]`:\n\n  Auto generate `object this[string key]` accessor\n\n  ```csharp\n  [AutoKeyAccessor]\n  class Foo\n  {\n      public bool Property { get; set; }\n  }\n  \n  /// \u003cgenerated\u003e\n  partial class Foo\n  {\n      public object? this[string key]\n      {\n          get\n          {\n              switch (key)\n              {\n                  case nameof(this.Property): return this.Property;\n              }\n              return null;\n          };\n          set\n          {\n              switch (key)\n              {\n                  case nameof(this.Property): this.Property = (bool)value; break;\n              }\n          };\n      }\n  }\n  ```\n\n+ #### `[AutoUnmamagedArray]`\n\n  Auto generate user defined length of array items, usually for `Marshal`\n\n  ```csharp\n  [AutoUnmamagedArray(nameof(T), 4)]\n  struct CharArray\u003cT\u003e where T : unmanaged{}\n  \n  /// \u003cgenerated\u003e\n  struct CharArray\u003cT\u003e where T : unmanaged\n  {\n      public T item0;\n      public T item1; \n      public T item2;\n      public T item3;\n  \n      public IEnumerable\u003cT\u003e Enumerate(){\n          yield return item0;\n          yield return item1; \n          yield return item2;\n          yield return item3;\n      }\n  }\n  ```\n\n+ #### `[AutoExtractInterface]`\n\n  Auto generate interface for specified type\n\n  like :\n\n  ![AutoExtractInterface_1](./docs/AutoExtractInterface_1.png)\n\n  will generate\n\n  ![AutoExtractInterface_2](./docs/AutoExtractInterface_2.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fautogen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantelcat%2Fautogen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantelcat%2Fautogen/lists"}