Dot net core web api Odata and Srp rule

I have a possible case where sonar is flagging a web api controller in error.
we use azure devops for repositories and builds.
the language is C# on dot net 8

i have a web api controller that has a method to use Odata / IQueryable on one method and that is beeing flagged for the SRP rule.

This controller has multiple responsibilities and could be split into 2 smaller controllers.

Controllers should not have mixed responsibilities csharpsquid:S6960

the controller has about 7 methods that all deal with the same entity.
if i remove the one get the sonar issue is gone.

but that means that i will then need a second controller to have one method for the same entity.

the controller is a standard api controller on ControllerBase
the method that triggers the message is like this:


[HttpGet]
[EnableQuery]
public IQueryable<WorItem> Get()
{
	return ctx.WorkItems;
}

ctx is an efcore context.

the controller also has a repository service that uses the same ef model.

i am wondering if that might be the source of the problem.

or if the scan just does not understand the option to have the enable query / odata option ?

found the solution to this.
it was a problem with using both an ef context and a repository class in the controller. had to remove the use of the context and pull the data from the repository class…
the repo uses the underlying context. at first i did not see that as an issue.

the srp error in sonar did notmention the data source issue and the code worked… so it was confusing.