I am building a winforms screen. On the screen, it will show
Category1 Sub-1-1 Sub-1-2 Sub-1-3 Category2 Sub-2-1
Click on the sub-1-1
will popup an screen and show the data related to sub-1-1; same for sub-1-2, ... etc. So there will be totally five forms (1 main form + 4 popup forms for the sample above (the actually will have about 30 sub categories)).
I have models for Categories
, sub-1-1
, sub-1-2
, ..., sub-2-1
. I am writing a service layer. Should I do,
public class ServiceLayer
{
CategoriesModel GetCategories();
Sub11Model GetSub11();
Sub12Model GetSub12();
Sub13Model GetSub13();
Sub21Model GetSub21();
.....
}
Or each form has its now service class instance?
public class ICategoryService { ... }
public class ISubCategoryService<T>
{
T GetSub();
}
var sub11 = new SubService<Sub11Model>();
var sub12 = new SubService<Sub12Model>();
var sub13 = new SubService<Sub13Model>();
var sub21 = new SubService<Sub21Model>();
....