{"id":13629347,"url":"https://github.com/Ohorodnikov/AutoDto","last_synced_at":"2025-04-17T08:34:38.927Z","repository":{"id":153503264,"uuid":"629617178","full_name":"Ohorodnikov/AutoDto","owner":"Ohorodnikov","description":"Auto copy properties from bl model to dto","archived":false,"fork":false,"pushed_at":"2023-11-01T16:26:44.000Z","size":7354,"stargazers_count":24,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T20:45:23.338Z","etag":null,"topics":["csharp-sourcegenerator"],"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/Ohorodnikov.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}},"created_at":"2023-04-18T17:13:02.000Z","updated_at":"2024-08-28T10:19:12.000Z","dependencies_parsed_at":"2024-01-10T22:10:39.007Z","dependency_job_id":"6e6a6288-2ff9-4a4d-95cf-16c54714936a","html_url":"https://github.com/Ohorodnikov/AutoDto","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ohorodnikov%2FAutoDto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ohorodnikov%2FAutoDto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ohorodnikov%2FAutoDto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ohorodnikov%2FAutoDto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ohorodnikov","download_url":"https://codeload.github.com/Ohorodnikov/AutoDto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249326186,"owners_count":21251735,"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"],"created_at":"2024-08-01T22:01:08.122Z","updated_at":"2025-04-17T08:34:38.649Z","avatar_url":"https://github.com/Ohorodnikov.png","language":"C#","funding_links":[],"categories":["Content","Source Generators"],"sub_categories":["54. [AutoDTO](https://ignatandrei.github.io/RSCG_Examples/v2/docs/AutoDTO) , in the [Mapper](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mapper) category","Mappers"],"readme":"# AutoDto\n\nThis tool allows to auto create DTO model from BL model in compile time.\n\nIt supports different strategies for relations, such as ReplaceToIdProperty, AddIdProperty and ReplaceToDtoProperty\n\n## Setup\n\nTo use AutoDto, first install the [NuGet package](https://www.nuget.org/packages/AutoDto):\n```shell\ndotnet add package AutoDto\n```\n\n- Declare partial DTO type like `public partial SomeDto {}`\n- Add attribute `[DtoFrom(typeof(SomeBlType))]`\n- Build project\n\nFull simple setup:\n\n```csharp\n[DtoFrom(typeof(SomeBlType))]\npublic partial SomeDto {}\n```\n \nAutoDto tool will generate partial SomeDto class with all public properties from SomeBlType.\n\n## Relation Strategies\n\nRelation strategy means what to do with relation property during generating DTO.\n\nSupported strategies:\n- None\n- ReplaceToIdProperty\n- AddIdProperty\n- ReplaceToDtoProperty\n\n### Usage\n\nSet strategy in `[DtoFrom]` attribute after BL type.\n\n```csharp\n[DtoFrom(typeof(SomeBlType), RelationStrategy.AddIdProperty)]\npublic partial SomeDto {}\n```\n\n\u003e If not specified - RelationStrategy.None will be used\n\n### None\nDTO will have property on BL type\n\n### ReplaceToIdProperty\nIf BL relation property has `Id` property:\nDTO will have only RelationPropName**Id** property of BL relation Id prop type.\nIf BlType has relation with array or enumerable - generated name will be RelationPropName**Ids**\n\n\u003e :exclamation: If no `Id` found in relation entity - result will be same as with None strategy\n\n### AddIdProperty\nDTO will have relation type property and `Id` property is found\n\n### ReplaceToDtoProperty\nTry find DTO, generated for RelationType and replace to RelationTypeDto.\n\n\u003e :exclamation: If many DTOs exists for RelationType - use `[MainDto]` attribute to mark which one should be used in `ReplaceToDtoProperty`\n\n\n## Ignore properties\n\nTo avoid some properties from BlType, use `[DtoIgnore]` attribute:\n\n```csharp\n[DtoFrom(typeof(SomeBlType), RelationStrategy.AddIdProperty)]\n[DtoIgnore(nameof(SomeBlType.PropName1), nameof(SomeBlType.PropName2))]\npublic partial SomeDto {}\n```\n\n## Options\n\nOptions can be set only in `.editorconfig`.\n\n\u003e :exclamation: All options are applied once, after first generator running (mostly after open project).\n\n### Generator running\n\nGenerator is based on `IIncrementalGenerator`. Generator is running on every class declaration change event (on every change that affects class structure).\nTo avoid performance issues, it is used debouncer for collecting all events to regenerate classes. By default debounce time is 500 ms. After some time debouncer will collect execution statistic and rebalance timer.\n\nAny user can turn off debouncer, set initial time ets by setting options in `.editorconfig`.\n\nSupported options:\n- auto_dto.debounce.enabled - true/false - use debounce or always run generation for every event\n- auto_dto.debounce.interval - int - in milliseconds - set initial debounce interval\n- auto_dto.debounce.auto_rebalance_enabled - true/false - allow auto timer change or not.\n\nDefault values:\n- auto_dto.debounce.enabled = true\n- auto_dto.debounce.interval = 500\n- auto_dto.debounce.auto_rebalance_enabled = true\n\n\u003e :warning: Debouncer can be turned off and switched to every request generating.\n\n### Logging\nLogger is disabled by default. If any issues with generator - enable logger, set folder path for logs and set logging level.\n\nSupported options:\n- auto_dto.logger.folder_path - string - path to folder where logs will be generated\n- auto_dto.logger.enabled - true/false\n- auto_dto.logger.log_level - Serilog log levels. See [LogEventLevel](https://github.com/serilog/serilog/blob/main/src/Serilog/Events/LogEventLevel.cs)\n\nDefault values:\n- auto_dto.logger.folder_path = Try get value from `build_property.projectdir`. If cannot - `Path.Combine(Environment.CurrentDirectory, \"Logs\")` is using\n- auto_dto.logger.enabled = false\n- auto_dto.logger.log_level = Warning\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOhorodnikov%2FAutoDto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOhorodnikov%2FAutoDto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOhorodnikov%2FAutoDto/lists"}