pdevito3 / craftsman

A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic 🚀
https://wrapt.dev
MIT License
1.12k stars 65 forks source link

Entity Id type #76

Closed zsyphon closed 2 years ago

zsyphon commented 2 years ago

Hello,

When I created a new:domain the resulting project contained Entities that contained an ID field of type GUID that was autogenerated by craftsman. I am wondering if there is a way to define the data type for the ID? Right now if I add an Id as a Property to my Entity then two Id fields are created resulting in build errors. The use case I have is that the Id field needs to be an INT because the legacy database we are using uses autoincremented Ids.

pdevito3 commented 2 years ago

Hey there, there's no way to toggle that in the current setup as it adds a ton of overhead and complexity to be dynamically typed.

With that said, You could fork the craftsman project and update it to use an integer instead of a guid and then use the forked project to support your scaffolding. You can pull up stream updates that I make overtime too and use what you want and ignore what you don't.

For the int migration, the main areas I can think of updating are in base entity, the DTO prop, the associated test scaffolding, and controllers.

I want to document this better and it's getting towards the top of my list but that's the long term goal as I know everyone will have tweaks they want to make.

Here's some MS docs that will help in the meantime.

https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use

zsyphon commented 2 years ago

Thank you!