Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutoEntityGenerator.Common.CodeInfo;
using System.Linq;

namespace AutoEntityGenerator.CodeGenerator;

Expand All @@ -13,7 +14,12 @@ public string GenerateMappingClassCode(Entity from, Entity to)
{
var indentationLevel = from.Namespace.IsFileScoped ? 3 : 4;
var indentation = new string('\t', indentationLevel);
var properties = GenerateProperties(from.Properties, p => $"{indentation}{p.Name} = source.{p.Name},");
var properties = GenerateProperties(
to.Properties.Count < from.Properties.Count
? to.Properties
: from.Properties,
p => $"{indentation}{p.Name} = source.{p.Name},"
);

return GenerateCode(from, to, properties);
}
Expand Down
4 changes: 2 additions & 2 deletions AutoEntityGenerator.Manifest/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ For more information, visit the [ReadMe](https://github.com/Peled-Zohar/AutoEnti
##
Please consider rating **AutoEntityGenerator** or leaving a review to help improve it!
Your feedback is valuable, whether it’s positive or critical, and will help shape future updates.

##
Changes from previous version:

1 Added an option to automatically open newly generated files in the editor.
2 fixed a minor typo in UI -> ("Browes" to "Browse")
1 fixed a bug in mapping extension method generation for response DTOs.


## How to use
Expand Down
4 changes: 2 additions & 2 deletions AutoEntityGenerator.Manifest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.1.0")]
[assembly: AssemblyFileVersion("2.3.1.0")]
[assembly: AssemblyVersion("2.3.2.0")]
[assembly: AssemblyFileVersion("2.3.2.0")]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="AutoEntityGenerator..3633938B-4D62-4E7A-92C3-BCBBD5DEEFE6" Version="2.3.1" Language="en-US" Publisher="Zohar Peled" />
<Identity Id="AutoEntityGenerator..3633938B-4D62-4E7A-92C3-BCBBD5DEEFE6" Version="2.3.2" Language="en-US" Publisher="Zohar Peled" />
<DisplayName>AutoEntityGenerator</DisplayName>
<Description xml:space="preserve">Automatically generates DTO and mapping classes based on your domain entities.</Description>
<MoreInfo>https://github.com/Peled-Zohar/AutoEntityGenerator/blob/main/README.md</MoreInfo>
Expand Down