T
Thabetidris
Guest
I have three levels of route attribute inheritance :
ClassA : ClassB public string Concat(..) [Route(..)] ClassB : ClassC [Route(..)] ClasseC: ControllerBase
The problem is that service "Concact" in the ClasseA never working !
Here is my code with details:
public class UniteAdministrativeController : ControleurRechercheBase<Entites.UniteAdministrative, DbContext>
{
protected readonly IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAOtest;
public UniteAdministrativeController(IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAO)
: base( rechercheDAO)
{
rechercheDAOtest = rechercheDAO;
}
[HttpPost]
[Route("Concat")]
public string Concat([FromBody] CritereRecherche critereRecherche)
{
//...
}
}
* ControleurRechercheBase
[Route("api/v{version:apiVersion}/[controller]")]
public abstract class ControleurRechercheBase<TEntite, TContexte> : ControleurObtentionBase<TEntite>
where TEntite : class
where TContexte : ContexteBase
{
protected readonly IRechercheDAO<TEntite, TContexte> RechercheDao;
protected ControleurRechercheBase(IRechercheDAO<TEntite, TContexte> rechercheDAO);
[HttpPost("Recherche")]
public Task<IActionResult> Rechercher([FromBody] CritereRecherche critereRecherche);
}
* ControleurObtentionBase :
[Route("api/v{version:apiVersion}/[controller]")]
public abstract class ControleurObtentionBase<T> : ControleurBase where T : class
{
protected ControleurObtentionBase();
[HttpGet]
[HttpGet("{parametre}")]
[ProducesAttribute("application/json", new[] { })]
public Task<IActionResult> Get(string parametre);
}
My problem here is i can't execute the action HTTPPOST "Concat" , and when i test it with POSTMAN: https://localhost:44339/api/v1.0/UniteAdministrative/
I get error 415,
How can I fix it? Or any idea to modify it ?
Continue reading...
ClassA : ClassB public string Concat(..) [Route(..)] ClassB : ClassC [Route(..)] ClasseC: ControllerBase
The problem is that service "Concact" in the ClasseA never working !
Here is my code with details:
UniteAdministrativeController
public class UniteAdministrativeController : ControleurRechercheBase<Entites.UniteAdministrative, DbContext>
{
protected readonly IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAOtest;
public UniteAdministrativeController(IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAO)
: base( rechercheDAO)
{
rechercheDAOtest = rechercheDAO;
}
[HttpPost]
[Route("Concat")]
public string Concat([FromBody] CritereRecherche critereRecherche)
{
//...
}
}
* ControleurRechercheBase
[Route("api/v{version:apiVersion}/[controller]")]
public abstract class ControleurRechercheBase<TEntite, TContexte> : ControleurObtentionBase<TEntite>
where TEntite : class
where TContexte : ContexteBase
{
protected readonly IRechercheDAO<TEntite, TContexte> RechercheDao;
protected ControleurRechercheBase(IRechercheDAO<TEntite, TContexte> rechercheDAO);
[HttpPost("Recherche")]
public Task<IActionResult> Rechercher([FromBody] CritereRecherche critereRecherche);
}
* ControleurObtentionBase :
[Route("api/v{version:apiVersion}/[controller]")]
public abstract class ControleurObtentionBase<T> : ControleurBase where T : class
{
protected ControleurObtentionBase();
[HttpGet]
[HttpGet("{parametre}")]
[ProducesAttribute("application/json", new[] { })]
public Task<IActionResult> Get(string parametre);
}
My problem here is i can't execute the action HTTPPOST "Concat" , and when i test it with POSTMAN: https://localhost:44339/api/v1.0/UniteAdministrative/
I get error 415,
How can I fix it? Or any idea to modify it ?
Continue reading...