Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 4

Generic repository pattern with asp.net core MVC

Solved! Go to Solution.

Hello all I have created a project which is here, I am getting some excpetion while executing the application can some one help me on this

 

https://github.com/Github743/RepositoryUOW

3 Replies
Community Manager
Message 2 of 4

Re: Generic repository pattern with asp.net core MVC

Hi @Github743,

 

Could you give some more details? At the very least, could you tell us what exception you're running into?

 

Thanks!

Copilot Lvl 3
Message 3 of 4

Re: Generic repository pattern with asp.net core MVC

First issue I am facing is TypeLoadException: Could not load type 'System.Data.Common.DbProviderFactories' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I have commented this line in my startup.cs

services.AddTransient((_) => new DatabaseContext());

Then I am getting the following error as follows

An unhandled exception occurred while processing the request. InvalidOperationException: Unable to resolve service for type 'CoreApp.DataProvider.DataContext.DatabaseContext' while attempting to activate 'CoreApp.DataProvider.EmployeeDataProvider'.
Solution
Copilot Lvl 3
Message 4 of 4

Re: Generic repository pattern with asp.net core MVC

I resolved the issue,as I have created the class library with .NET Framework it is causing the issue. I have created new class library with class library with .NET Standard and it is working as expected