Base solution for your next web application
Open Closed

How could I find all my registed DynamicApiController #32


User avatar
0
gele.qing created

Hey, I hav a project wity Angularjs/MVC. Then i create some IApplicationService code:

public interface IDataCodeAppService : IApplicationService
{
        Abp.Application.Services.Dto.IListResult<Dto.DataCodeOutput> GetChildrenItems(int parentid)
}
public abstract class MyAppServiceBase: ApplicationService{
}
 public class DataCodeAppService :MyAppServiceBase, IDataCodeAppService
{
public Abp.Application.Services.Dto.IListResult<Dto.DataCodeOutput> GetChildrenItems(int parentid)
        {
            var list = new List<Dto.DataCodeOutput>();
            list.Add(new Dto.DataCodeOutput() { ID=1,Name="CS1"});
            list.Add(new Dto.DataCodeOutput() { ID = 2, Name = "CS2" });
            list.Add(new Dto.DataCodeOutput() { ID = 3, Name = "CS3" });
            list.Add(new Dto.DataCodeOutput() { ID = 4, Name = "CS4" });
            list.Add(new Dto.DataCodeOutput() { ID = 5, Name = "CS5" });
                //DataRepository.GetAllList(x => x.ParentID == parentid).Select(x => x.MapTo<Dto.DataCodeOutput>()).ToList().AsReadOnly();
            return new ListResultOutput<Dto.DataCodeOutput>(list.AsReadOnly());
        }
}

The WebApiModule is

[DependsOn(typeof(AbpWebApiModule), typeof(MyApplicationModule))]
    public class MyWebApiModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

            DynamicApiControllerBuilder
                .ForAll<IApplicationService>(typeof(MyApplicationModule).Assembly, "app")
                .Build();
        }
    }

The MyApplicationModule is

[DependsOn(typeof(MyCoreModule))]
    public class MyApplicationModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }

But in my Chrome,I got the 404, my Uri is <a class="postlink" href="http://localhost:61754/api/services/app/address/GetChildrenItems">http://localhost:61754/api/services/app ... ldrenItems</a> Now,I have some Questions: 1.Why is 404? 2.How could I explorer my registed api with aspnetboilerplate. I have use ApiExplorer to explorer the api,but only get this:

Uri:api/AbpServiceProxies?name={name}&type={type}
Http Model:GET;

Uri:api/AbpServiceProxies?type={type}
Http Model:GET;

Uri:api/AbpServiceProxies?name={name}
Http Model:POST;

Uri:api/AbpServiceProxies?name={name}&culture={culture}
Http Model:POST;

Uri:api/ServiceProxies?name={name}
Http Model:GET;

Uri:api/ServiceProxies
Http Model:GET;

Uri:api/ServiceProxies?name={name}
Http Model:POST;

Uri:api/ServiceProxies?name={name}&culture={culture}
Http Model:POST;

Please Help!


2 Answer(s)
  • User Avatar
    0
    gele.qing created

    Questions 1 has Solved,The URI is not validate. :D there is only Questions 2.

  • User Avatar
    0
    hikalkan created
    Support Team

    Use DynamicApiControllerManager.GetAll() static method.