-
I wonder why the generated beer example uses classes instead of records for DTOs ( Tnx |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @dmurat, We rather favor the usage of a fluent builder for creating an instance, that will force you to set all required fields, and will guide you so that you don't permute parameters by accident. While it could be possible to also create a builder with a record too, since the record constructor has to be public, it would allow to bypass construction by builder. I hope that this is clear enough :) |
Beta Was this translation helpful? Give feedback.
-
Tnx for an explanation. |
Beta Was this translation helpful? Give feedback.
Hi @dmurat,
We're not using records because record create a default public constructor with all fields.
We rather favor the usage of a fluent builder for creating an instance, that will force you to set all required fields, and will guide you so that you don't permute parameters by accident.
While it could be possible to also create a builder with a record too, since the record constructor has to be public, it would allow to bypass construction by builder.
I hope that this is clear enough :)