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

Missing using statements in domain entities #126

Closed AnNormalie closed 11 months ago

AnNormalie commented 11 months ago

After scaffolding a new api with craftsman version 0.23.0 I get an error when I try to build the project. image

it seems that there are missing using statements in the entities class. image image

Missing usings are: using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; or using Newtonsoft.Json; using System.Runtime.Serialization;

Steps to reproduce

Further technical details

Craftsman version (dotnet tool list -g): 0.23.0

AnNormalie commented 11 months ago

I just got some time and tried to reproduce it with modifying the example projects, but till now I could not reproduce the bug. The template file that produces the issue is an older template that have the old relationship mapping, could it be that this produces the issue?

I need to test this tomorrow when I am at work again.

Is the old relation mapping still supported?

AnNormalie commented 11 months ago

The Issue with the missing using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations; statements I got reproduced. When Adding TableName and Schema to the Entity Properties in the yaml/json file. And the IsRequired Attribute.

image image

pdevito3 commented 11 months ago

Interesting. Yeah I've actually been trying to move away from attributes to keep things focused on the db config file for the entity and reduce clutter. This one slipped through the cracks. Will try and address in a patch and figure out a longer term plan for after.

Thanks