{"id":22327943,"url":"https://github.com/duydang2311/altv.community.mvalueadapters.generators","last_synced_at":"2025-07-29T18:31:10.682Z","repository":{"id":218167710,"uuid":"745769578","full_name":"duydang2311/AltV.Community.MValueAdapters.Generators","owner":"duydang2311","description":"A roslyn source generator for MValue adapter implementation in alt:V","archived":false,"fork":false,"pushed_at":"2024-10-19T20:17:08.000Z","size":69,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-10T09:15:44.992Z","etag":null,"topics":["altv","coreclr-module","csharp","roslyn-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/duydang2311.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":"2024-01-20T04:50:49.000Z","updated_at":"2024-10-19T20:17:12.000Z","dependencies_parsed_at":"2024-01-27T12:31:41.162Z","dependency_job_id":"10d96eef-c9a6-4841-8b82-818e342cd18e","html_url":"https://github.com/duydang2311/AltV.Community.MValueAdapters.Generators","commit_stats":null,"previous_names":["duydang2311/altv.community.mvalueadapters.generators"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duydang2311%2FAltV.Community.MValueAdapters.Generators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duydang2311%2FAltV.Community.MValueAdapters.Generators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duydang2311%2FAltV.Community.MValueAdapters.Generators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duydang2311%2FAltV.Community.MValueAdapters.Generators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duydang2311","download_url":"https://codeload.github.com/duydang2311/AltV.Community.MValueAdapters.Generators/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228034977,"owners_count":17859245,"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":["altv","coreclr-module","csharp","roslyn-generator"],"created_at":"2024-12-04T03:11:07.844Z","updated_at":"2024-12-04T03:11:08.391Z","avatar_url":"https://github.com/duydang2311.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### This repository has been archived and migrated to [AltV.Community](https://github.com/duydang2311/AltV.Community) monorepo.\n\n## AltV.Community.MValueAdapters.Generators\n\n[![NuGet badge](https://img.shields.io/nuget/v/AltV.Community.MValueAdapters.Generators?color=blue\u0026cacheSeconds=3600)](https://www.nuget.org/packages/AltV.Community.MValueAdapters.Generators/)\n\n### Quickstart\n\nThis library helps you generate the needed code for implementing any MValue adapter.\n\n#### Installation\n\n1. Add the NuGet package to your project.\n\n```bash\ndotnet add package AltV.Community.MValueAdapters.Generators\n```\n\n2. *(Optional)* Enable `EmitCompilerGeneratedFiles` flag in your `.csproj` by adding this to your `\u003cPropertyGroup\u003e`.\n\nThis helps preventing generated files not found issue if you happen to use copy build output task.\n\n```xml\n\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n```\n\n3. *(Optional)* In case there are [CS0436](https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0436) warnings during compilation, you must add these attributes to your `\u003cPackageReference\u003e`.\n\n```xml\n\u003cPackageReference Include=\"AltV.Community.MValueAdapters.Generators\" PrivateAssets=\"all\" ExcludeAssets=\"runtime\" /\u003e\n```\n\n**Note:** If you use a _shared_ project between client and server, only add the NuGet to the _shared_ project and neither to the client nor server project to avoid ambigious references.\n\n#### Generate your first MValue adapter\n\n1. Add `MValueAdapter` attribute to your class.\n\n```csharp\nusing AltV.Community.MValueAdapters.Generators;\n\n[MValueAdapter]\npublic class ParentDto\n{\n    public string First { get; set; } = string.Empty;\n    public string Second { get; set; } = string.Empty;\n    public ChildDto Dto { get; set; } = null!;\n}\n\n[MValueAdapter]\npublic class ChildDto\n{\n    public string First { get; set; } = string.Empty;\n    public string Second { get; set; } = string.Empty;\n}\n```\n\n2. Register the MValue adapters generated when the resource (client / server) starts.\n\n```csharp\npublic override void OnStart()\n{\n    AltExtensions.RegisterAdapters();\n}\n```\n\nHuge thanks to deluvas1911 for sharing his great work and allowing me to open source this.\n\n### How to contribute\n\nIf you'd like to contribute, some adjustments need to be made to the project setup.\n\n1. Fork the project, clone and build it `dotnet build`.\n2. Remove any existing `\u003cPackageReference\u003e` to this project from your `Server`/`Client` project.\n3. Add the following lines to an `\u003cItemGroup\u003e` and replace the `Include=` value with the relative paths:\n\n```xml\n\u003cProjectReference Include=\"..\\AltV.Community.MValueAdapters.Generators\\AltV.Community.MValueAdapters.Generators.csproj\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"false\" PrivateAssets=\"all\" /\u003e\n\u003cProjectReference Include=\"..\\AltV.Community.MValueAdapters.Generators.Abstractions\\AltV.Community.MValueAdapters.Generators.Abstractions.csproj\" OutputItemType=\"Analyzer\" /\u003e\n```\n4. Add the following line to an `\u003cItemGroup\u003e` in your `Server`/`Client` project to view generated files:\n\n```xml\n\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n```\n\n5. In your `Server`/`Client` project, make sure you clear the generator cache before building to keep generated files always latest, or you can use the command below which already does that.\n\n```bash\ndotnet build-server shutdown \u0026\u0026 dotnet clean \u0026\u0026 dotnet build\n```\n\n---\n\n### Other community libraries\n\n- [AltV.Community.Events](https://github.com/duydang2311/AltV.Community.Events): create events as classes with both sync and async support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduydang2311%2Faltv.community.mvalueadapters.generators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduydang2311%2Faltv.community.mvalueadapters.generators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduydang2311%2Faltv.community.mvalueadapters.generators/lists"}