Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Using IOC in dynamicly loaded web area dll #300


User avatar
0
klainer created

Hello, thanks for your awesome work! I Have some question about using ABP. I downloaded ABP - Module Zero template, after that I extend Core project with code which I use for dynamic loading DLL subsystems. Subsystem is a normal Project with area registration class. This subsystem is loaded to Web folder called "Subsystems". In web project I created PreStart class which inicialize subsystem. Everything works, subsystem is loaded and area registered. But I want to use repositories and services form ABP in this dynamicly loaded subsystem. When i create controller like below I got this error:

'CmsSubsystem.Services.TeacherAppService' is waiting for the following dependencies:

  • Service 'Abp.Domain.Repositories.IRepository`1[[CmsSubsystem.Entities.Ucitel, CmsSubsystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

When I´m loading dynamic dll of subsystem (area) in CoreModule I register assembly dependecy like this:

dependencyContainer.RegisterAssemblyByConvention(AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == "CmsSubsystem"));

But services, repositories no works... Which is the correct way and place to register dependencies when I´m using this appropoach (cutom project with area registration class compiled to dll and moved to WebModule Subsystems folder).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Abp.Authorization;
using Abp.Domain.Repositories;
using Abp.Web.Mvc.Authorization;
using Abp.Web.Mvc.Controllers;
using CmsSubsystem.Entities;
using CmsSubsystem.Services;

namespace CmsSubsystem.Controllers
{
    [AbpMvcAuthorize]
    public class DashboardController : BaseController
    {

        private IUcitelAppService _ucitelAppService;

        public DashboardController(IUcitelAppService ucitelAppService)
        {
            _ucitelAppService = ucitelAppService;
        }

        public ActionResult Index()
        {
            IQueryable<Ucitel> ucitele = _ucitelAppService.GetUcitele();
            return View(ucitele);
        }
    }
}

Thanks for tips !


1 Answer(s)
  • User Avatar
    0
    yoni created

    Hi.. Is this even possible?