Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to place Business Entities, Enums, Custom exceptions?

I'm trying to figure out how to share my entities between the data, business, and UI tiers. Is it best to create a separate project for these entities that will be referenced by all the tiers? What about Enums and custom exceptions? I have some enums used only by the UI project, and some that are used by the Business. Does this mean I should have two separate Enum folders: one in the Business project and one in the UI? Similarly with Exceptions? Till now, I have been maintaining the entities, enums, and exceptions all in one separate project that are referenced by all the 3 tiers.

My Business project has Manager classes (like ProductManager.cs) which have methods like List GetProducts() and SaveProduct(Product), etc.

like image 434
Prabhu Avatar asked Feb 27 '23 22:02

Prabhu


1 Answers

You've been doing the right thing. Creating a separate project with all entities are almost always the way to go. If the enums and exceptions are entity-related, they belong in there as well.

like image 88
Oliver John Avatar answered Mar 12 '23 12:03

Oliver John