AutoEntityGenerator is a Visual Studio extension that simplifies the process of generating Data Transfer Objects (DTOs) and mapping extensions based on existing domain entity classes. This extension helps developers quickly create and maintain supporting classes, enhancing productivity and reducing manual coding errors.
Currently, only types with parameterless constructors are supported for mapping generation.
If the model doesn't have a parameterless constructor, the generated mapping extension will not compile.
In future versions, I plan to support entities without parameterless constructors by allowing users to include the properties that correspond to the constructor parameters.
This project is licensed under the MIT License - see the LICENSE file for details.
You can install the AutoEntityGenerator extension directly from the Visual Studio Marketplace.
Simply navigate to the extension's page and click on "Install" to add it to your Visual Studio environment.
Alternatively, you can install the extension by downloading the .vsix
file from the latest release.
Once downloaded, double-click the .vsix
file and follow the instructions in the VSIX installer to complete the installation.
Currently only supported target is visual studio 2022 community version.
I plan to expand that in the future, but I will need to test each target platform before adding them to the supported target list.
AutoEntityGenerator allows you to configure various aspects of the code generation process, including:
Suppose you have a domain entity class Product
:
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
Using AutoEntityGenerator, you can generate the following Request DTO and mapping method with just a few mouse clicks:
public partial class CreateProductRequest
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
public static partial class CreateProductRequestDtoMappingExtensions
{
public static Product ToProduct(this CreateProductRequest request)
{
return new Product
{
Id = request.Id,
Name = request.Name,
Price = request.Price
};
}
}
We welcome contributions to improve AutoEntityGenerator! If you encounter any bugs or have feature requests, please open an issue on the GitHub repository.
Thank you for using AutoEntityGenerator! We hope it enhances your development experience by automating the creation of DTOs and mapping methods.