Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

My Swashbuckle.AspNetCore.Swagger have a problem

I have an API to convert currencies based on a local database. I create my controller, serive, repository and even though I can perform the query in the database I don’t get the same result via API.I’ve already spent a few hours trying to solve this and nothing seems to work, here’s the print.enter image description here. This case not is equals my problem because my swagger loads. This case not is equal my problem because i don’t care about swagger color.

My controller:

[ApiController]
[Route("api/[Controller]")]
public class CurrencyController : ControllerBase
{
    [HttpGet]
    [Route("{code}")]
    public ObjectResult GetByCode([FromServices] CurrencyReadRepository repository, string code)
    {
        return Ok(repository.GetCurrency(code));
    }
...

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can try on StartUp.cs:

services.AddTransient<CurrencyReadRepository>();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading