I just have started to design with DDD (I have no experience neither a teacher)
I have some domain service classes that have to reference each other in some point. So I decided to inject the references through constructor.
And when I created a view that has a lot of data to display in the controller I had to create a bunch of service (some of which referencing each other)
At this point one of my controller's first lines looked like this:
EmployeeRepository employRepository = new EmployeeRepository();
ShiftModelRepository shiftModelRepository = new ShiftModelRepository();
ShiftModelService shiftModelService = new ShiftModelService(shiftModelRepository);
EmployeeService employeeService = new EmployeeService(employRepository, shiftModelService);
OvertimeRepository overtimeRepository = new OvertimeRepository();
OvertimeService overtimeService = new OvertimeService(overtimeRepository, employeeService);
But I started to create interfaces for the services and using a IoC controller (named StructureMap)
And now the same controller's first lines looked like this:
IShiftModelService shiftModelService = ObjectFactory.GetInstance<IShiftModelService>();
IOvertimeService overtimeService = ObjectFactory.GetInstance<IOvertimeService>();
IEmployeeService employeeService = ObjectFactory.GetInstance<IEmployeeService>();
I think that it's far more good to use, but I to know if it is a good practice in DDD or not.