jbubriski / ST4bby

A POCO generator that doesn't rely on the Entity Framework.
MIT License
18 stars 8 forks source link

Partial classes and constructors. #16

Closed LosManos closed 12 years ago

LosManos commented 12 years ago

I have created partial classes, settable in settings if the classes should be partial or not. I have created static constructors. The names and if they should be created at all is settable.

I have used partial classes earlier with Codesmith/nettiers and been very satisfied. It makes it possible for the user to add functionality in their classes at will; without having to dive into St4bby.

I also like to have constructors that takes all parameters to make sure they are fully populated. See: http://www.selfelected.com/make-sure-your-objects-are-fully-populated-%E2%80%93-fail-at-once/ I made the constructors static so as to give the user more freedom. If they had been "normal" constructors I would also have had to create a default constructor and then the user can't write his own. I made 2 constructors, one with all parameters and one with the primary key lacking.