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 66 forks source link

Overwrite option and MaxLength attribute in property #104

Closed emirtb closed 1 year ago

emirtb commented 1 year ago

In my case, I spend a lot of time making changes after creating an entity by adding new properties.

For this reason I had to add this option to my fork:

add entity [/path/file.yaml] true With this, I can overwrite the changes. In order for this to work well, in the future I need to add my personal code in partial.

It is also a lot of code that I have to write to limit the size of the text fields, I have added this option:

Entities:

pdevito3 commented 1 year ago

Sorry I'm just getting to properly look at this. Thanks for the idea!

It seems like the motivator here is to add new properties? I used to have functionality that did that without overriding the whole file, but it didn't really seem to save any dev time; it did add maintenance overhead though and was a motivator to remove it at the time. I'm considering some flows where it might more more useful though so maybe it'll make a comeback.

With this particular implementation though, I'm hesitant to bring it in as it would completely eliminate the ability to maintain any post scaffolding updates. Maybe you've added some custom helper methods, updated props to value objects, etc. This would force you to just use the boilerplate when it's not meant to be the end, just the start. Given that, I don't think this PR is a good fit for the lib but if it's working well for you're workflow in your fork that's great to hear!

With that said, adding the option for a max length would be reasonable. Personally I'm not a huge fan of using the db to enforce business rules as that should really be a domain responsibility, but that's personal preference and wouldn't add much maintenance overhead so if you'd like to submit something around that I think that's great.

Regardless, thanks again for taking the time to contribute and working to improve the tool for other devs.