I have created an app service but having difficulties with its dependencies.
Can't create component 'Roxybox.TrainingManager.Course.CourseAppService' as it has dependencies to be satisfied.
'Roxybox.TrainingManager.Course.CourseAppService' is waiting for the following dependencies:
- Service 'Roxybox.TrainingManager.Courses.Managers.ICourseManager' which was not registered.
The CourseManager appears to be the issue but not sure how to resolve it.
public class CourseAppService : TrainingManagerAppServiceBase, ICourseAppService
{
private readonly CourseManager _courseManager;
public CourseAppService(
CourseManager courseManager)
{
_courseManager = courseManager;
}
public abstract class CourseManager : IDomainService, ITransientDependency
{
public ILocalizationManager LocalizationManager { get; set; }
protected IRepository<Course> CourseRepository { get; set; }
protected CourseManager(
IRepository<Course> courseRepository)
{
CourseRepository = courseRepository;
LocalizationManager = NullLocalizationManager.Instance;
}
5 Answer(s)
-
0
Hi,
If you are using IDomainService, you dont have to use ITransientDependency because IDomainService already derives from it.
Your CourseManager class must derive from DomainService class not IDomainService interface. For a correct implementation please check Domain Service documentation here <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Domain-Services">http://aspnetboilerplate.com/Pages/Docu ... n-Services</a>
-
0
I have updated the CourseManager class based on the documentation and still get the error.
public abstract class CourseManager : DomainService, ICourseManager { public ILocalizationManager LocalizationManager { get; set; } protected IRepository<Course> CourseRepository { get; set; } protected CourseManager( IRepository<Course> courseRepository) { CourseRepository = courseRepository; LocalizationManager = NullLocalizationManager.Instance; } }
public interface ICourseManager : IDomainService { }
-
0
Has you check if is a possibile loop of injection?
Check in browser console the full stack of exception.
-
0
Thanks for the help andmattia. I found that the issue was down to me missing the fact that the Entity was not in the DbContext.
After adding it everything started to work.
-
0
your welcome!