From 36b1f220b4e62125731cddb70de7ffe7c77ede3b Mon Sep 17 00:00:00 2001 From: James Date: Wed, 19 Nov 2025 09:19:42 +0100 Subject: [PATCH 1/2] moved example added license and CONTRIBUTING.md --- CONTRIBUTING.md | 16 ++++++ LICENSE.md | 3 + Readme.md | 22 ++----- TenJames.CompMap.sln | 10 ++-- .../TenJames.CompMap.Example}/Entitities.cs | 57 ++++++++++++++++++- .../TenJames.CompMap.Example}/Program.cs | 0 .../TenJames.CompMap.Example.csproj | 2 +- 7 files changed, 85 insertions(+), 25 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.md rename {TenJames.CompMap.Example => TenJames.CompMap/TenJames.CompMap.Example}/Entitities.cs (50%) rename {TenJames.CompMap.Example => TenJames.CompMap/TenJames.CompMap.Example}/Program.cs (100%) rename {TenJames.CompMap.Example => TenJames.CompMap/TenJames.CompMap.Example}/TenJames.CompMap.Example.csproj (79%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..465102f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +## Contributing to This Project + +We welcome contributions from the community! If you'd like to contribute to this project, please follow these steps: + +1. Fork the repository on GitHub. +2. Create a new branch for your feature or bug fix. +3. Make your changes and ensure that they are well-documented. +4. Write tests for your changes to ensure they work as expected. +5. Submit a pull request with a clear description of your changes. + +Please make sure to adhere to the project's coding standards and guidelines. We appreciate your efforts to improve this project! + +--- + +## License +This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0c36423 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,3 @@ +# License + +All rights reserved to Jakub Indrák. diff --git a/Readme.md b/Readme.md index f8a295c..23b200d 100644 --- a/Readme.md +++ b/Readme.md @@ -127,26 +127,14 @@ Add Attributes to your DTO classes and then enjoy the generated mapping methods --- -## Continuous Integration (GitHub Actions) +## Example -A workflow was added at `.github/workflows/ci.yml` to automate verification and publishing: -- On pull requests (opened/synchronized/reopened): - - Restores, builds the solution and runs tests (if the `TenJames.CompMap.Tests` project exists). +See the [Example](./TenJames.CompMap.Example) project for a complete working example. -Quick commands (run locally) — fish shell: -```fish -# Build and test locally -dotnet restore -dotnet build TenJames.CompMap.sln -c Release -dotnet test TenJames.CompMap/TenJames.CompMap.Tests -c Release +## Contributing -# Create a tag and push (publish via CI) -git tag v1.2.3 -git push origin v1.2.3 -``` - -If you'd prefer bumping major/minor instead of patch in PRs, or if you want bumping to commit via a bot account or a separate branch/PR, I can adapt the workflow. +Contributions are welcome! Please fork the repository and submit a pull request with your changes. ---- +see [CONTRIBUTING.md](CONTRIBUTING.md) for details. diff --git a/TenJames.CompMap.sln b/TenJames.CompMap.sln index ca0a259..7f1e5bb 100644 --- a/TenJames.CompMap.sln +++ b/TenJames.CompMap.sln @@ -4,7 +4,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TenJames.CompMap", "TenJame EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TenJames.CompMap.Tests", "TenJames.CompMap\TenJames.CompMap.Tests\TenJames.CompMap.Tests.csproj", "{045DCA29-C2DC-4707-9521-98097B1B2F84}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TenJames.CompMap.Example", "TenJames.CompMap.Example\TenJames.CompMap.Example.csproj", "{B4418CCB-2984-4651-ABE3-E14B620171C3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TenJames.CompMap.Example", "TenJames.CompMap\TenJames.CompMap.Example\TenJames.CompMap.Example.csproj", "{B7BB7EF5-EBA5-45F2-903F-9A0DBCAD0D9C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -20,9 +20,9 @@ Global {045DCA29-C2DC-4707-9521-98097B1B2F84}.Debug|Any CPU.Build.0 = Debug|Any CPU {045DCA29-C2DC-4707-9521-98097B1B2F84}.Release|Any CPU.ActiveCfg = Release|Any CPU {045DCA29-C2DC-4707-9521-98097B1B2F84}.Release|Any CPU.Build.0 = Release|Any CPU - {B4418CCB-2984-4651-ABE3-E14B620171C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4418CCB-2984-4651-ABE3-E14B620171C3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4418CCB-2984-4651-ABE3-E14B620171C3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4418CCB-2984-4651-ABE3-E14B620171C3}.Release|Any CPU.Build.0 = Release|Any CPU + {B7BB7EF5-EBA5-45F2-903F-9A0DBCAD0D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7BB7EF5-EBA5-45F2-903F-9A0DBCAD0D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7BB7EF5-EBA5-45F2-903F-9A0DBCAD0D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7BB7EF5-EBA5-45F2-903F-9A0DBCAD0D9C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/TenJames.CompMap.Example/Entitities.cs b/TenJames.CompMap/TenJames.CompMap.Example/Entitities.cs similarity index 50% rename from TenJames.CompMap.Example/Entitities.cs rename to TenJames.CompMap/TenJames.CompMap.Example/Entitities.cs index ed91c1e..2eefd6c 100644 --- a/TenJames.CompMap.Example/Entitities.cs +++ b/TenJames.CompMap/TenJames.CompMap.Example/Entitities.cs @@ -47,7 +47,7 @@ private static partial UserUnmappedProperties GetUserUnmappedProperties(IMapper { return new UserUnmappedProperties() { - + }; } } @@ -56,4 +56,57 @@ private static partial UserUnmappedProperties GetUserUnmappedProperties(IMapper public partial class DocumentDto { public string Title { get; set; } public string Content { get; set; } -} \ No newline at end of file +} + +/* + *Generated files + * + * UserReadDto.g.cs + * ```cs + * + * + using System; + using System.Collections.Generic; + + using TenJames.CompMap.Mappper; + + namespace TenJames.CompMap.Example; + + partial class UserReadDto + { + + /// + /// The following properties were not mapped because they do not exist in the target class + /// + internal class UserUnmappedProperties + { + /// + /// Found at /Entitities.cs at 29 + /// + public required string Title { get; set; } + } + + private static partial UserUnmappedProperties GetUserUnmappedProperties(IMapper mapper, User source); + + /// + /// Mapping method generated by TenJames.CompMap + /// + public static UserReadDto MapFrom(IMapper mapper, User source) + { + // Note: Some properties were not mapped due to missing counterparts in the target class. + var unmapped = GetUserUnmappedProperties(mapper, source); + return new UserReadDto + { + Id = source.Id, + Name = source.Name, + Guid = source.Guid, + Documents = mapper.Map >(source.Documents), + Title = unmapped.Title, + }; + } + } + * ``` + * + * Others follow similar pattern + * + */ diff --git a/TenJames.CompMap.Example/Program.cs b/TenJames.CompMap/TenJames.CompMap.Example/Program.cs similarity index 100% rename from TenJames.CompMap.Example/Program.cs rename to TenJames.CompMap/TenJames.CompMap.Example/Program.cs diff --git a/TenJames.CompMap.Example/TenJames.CompMap.Example.csproj b/TenJames.CompMap/TenJames.CompMap.Example/TenJames.CompMap.Example.csproj similarity index 79% rename from TenJames.CompMap.Example/TenJames.CompMap.Example.csproj rename to TenJames.CompMap/TenJames.CompMap.Example/TenJames.CompMap.Example.csproj index dc0069f..3a0a05b 100644 --- a/TenJames.CompMap.Example/TenJames.CompMap.Example.csproj +++ b/TenJames.CompMap/TenJames.CompMap.Example/TenJames.CompMap.Example.csproj @@ -8,6 +8,6 @@ - + From bdf3fd8dc77b87b730761350287b19f1ad274953 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 08:21:22 +0000 Subject: [PATCH 2/2] ci: bump version to 0.1.6 [skip ci] --- TenJames.CompMap/TenJames.CompMap/TenJames.CompMap.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TenJames.CompMap/TenJames.CompMap/TenJames.CompMap.csproj b/TenJames.CompMap/TenJames.CompMap/TenJames.CompMap.csproj index 0fb42d6..5061468 100644 --- a/TenJames.CompMap/TenJames.CompMap/TenJames.CompMap.csproj +++ b/TenJames.CompMap/TenJames.CompMap/TenJames.CompMap.csproj @@ -14,7 +14,7 @@ - 0.1.5 + 0.1.6 Compiletime Mapper Map your object on compile time https://github.com/Ten-James/CompMap