Base solution for your next web application

Activities of "winson"

Yes, that strange, when I create a new table and controller, I got the error again, don't know why :(

I got the below errors:

Server Error in '/' Application.

Can't create component 'MPeLife.FormLayoutApp.FormLayoutAppService' as it has dependencies to be satisfied.

'MPeLife.FormLayoutApp.FormLayoutAppService' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`1[[MPeLife.Models.FormLayout, MPeLife.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

in my controller:

private readonly IFormLayoutAppService _formLayoutAppService;

public FormLayoutController(IFormLayoutAppService formLayoutAppService)
{
       _formLayoutAppService = formLayoutAppService;
}

in app service:

private readonly IRepository<FormLayout> _formLayoutRepository;

public FormLayoutAppService(IRepository<FormLayout> formLayoutRepository)
{
     _formLayoutRepository = formLayoutRepository;
}

I didn't change any things, just create the new table:(

yes, actually I tried everything before, but still not working, but when I reset the DB and run update-database again, that's working, maybe I use the difference table name between entity and database, but suppose that's not be an issue, I have set the table attribute in the entity model

ok, I have resolved my problem, it's spend me a whole day, it maybe because my entity model name is not same with the database table name, when I drop the table and run update-database again, the problem is solved :(

I want to create the multiple pages project and not use angular script, so I want to call the app service directly in my controller, but I tried many ways and still failed, after I read the Dependency Injection , seems there is a way to resolve the service directly, but I still failed, below is my code:

app service:

private readonly IFormBuilderRepository _formBuilderRepository;

        public FormBuilderAppService(IFormBuilderRepository formBuilderRepository)
        {
            _formBuilderRepository = formBuilderRepository;
        }

in controller:

private readonly IIocResolver _iocResolver;

        public FormBuilderController(IIocResolver iocResolver)
        {
            _iocResolver = iocResolver;
        }

and in the action:

[HttpPost]
        [UnitOfWork]
        public JsonResult Index(FormBuilderInput formBuilder)
        {
            var _formBuilderAppService = _iocResolver.Resolve<IFormBuilderAppService>();
            _formBuilderAppService.Create(formBuilder);
            _iocResolver.Release(_formBuilderAppService);

            return Json(new { Name = formBuilder.Name });
        }

after run these code, I got the below error:

ABP The entity type FormBuilderModel is not part of the model for the current context.

I have no ideas :(

for example, I have an IAbcAppService and AppService class, but how can I call it in my controller? I don't know how to instantiate it

in my app service:

public class ABCAppService: IABCAppService
{
        private readonly IRepository<ABCModel> _abcRepository;

        public ABCAppService(IRepository<ABCModel> abcRepository)
        {
            _abcRepository = abcRepository;
        }
}

and in my controller:

public class ABCController : ABCControllerBase
{
        private readonly IABCAppService _abcAppService;

        public ABCController()
        {
        	//should I use this way? but it doesn't work :(
            _abcAppService = IocManager.Instance.Resolve<IABCAppService>();
        }
}

just don't know how to init the _abcAppService in controller.

Showing 21 to 25 of 25 entries