Ardalis Specification Repository can be injected but when call any method, get object reference error

451 views Asked by At

I use Ardalis Specifications with Entity Framework. I wrote my app in .NET 7 and I use an onion architecture with mediatr pattern. I have a generic interface IRepository and I define it as scoped.

When I inject this variable is not null but when I use any method of repository then I got an error

Object reference set not an instance of an object

I created an issue on GitHub repository but Stackoverflow users are much more responsive than GitHub issue checker users, so if you look at it, I will appreciate it.

Link: Ardalis Specification Github Issues

1

There are 1 answers

0
Mustafa Ulukaya On BEST ANSWER

I didn't pass tenant so if table multitenant and you did not pass tenantId to application, then this error raised. Problem solved when tenantId passed.