Skip to content

IActionResult vs ActionResult #2

@crisrizz70

Description

@crisrizz70

Hi, I'm trying to implement this repository pattern and I'm having some issues. I'm an experienced backend developer but this is my first API so I apologize in advance for my ignorance. I'm trying to implement my controller code and based on the docs for .NET Core 2.2, the suggested method is to return an ActionResult instead of IActionResult. This throws a cast exception due to the IEnumerable. I understand the reason why this exception is thrown, I just don't know what is the correct way to resolve it. Should I revert to using IActionResult in this case and if so what are the consequences on the rest of the code? Or how should I modify the EntityRepository code to make this work with ActionResult?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions