Last post Jul 16, 2018 12:55 PM by DA924
Jul 14, 2018 08:09 PM|omiii|LINK
I am studying/ Developing new application in Core.
For this I have reffered below article.
IN which i have followed all the steps mentioned in the article. I just used DB first approach to create the classes in the database classes using command for scafolding. One more thing I have creted seprate library for models and generic repository and for
interface. Then one seprate library service for implementing my indivisuals classes of interface and repository.
Now i am facing error is datacontext object =null everytime how can i resolve this issue? please help me to resolve issue.
Thanks in advance.
Jul 14, 2018 11:24 PM|DA924|LINK
do you want to try posing some actual code an show the null valued object?
Jul 16, 2018 05:56 AM|Edward Z|LINK
Could you share us a simple project through GitHub to reproduce your issue?
Based on your description, I assume your issue is more related with this part “One more thing I have creted seprate library for models and generic repository and for interface.”.
Have you registered your DbContext in Startup.cs?
Jul 16, 2018 12:55 PM|DA924|LINK
I did look at your link. It is showing how to use the generic repository [pattern. I am not a fan of the generic repository pattern.
I just converted over an ASP.NET MVC solution using the Data Access Layer and DAO design patterns that is using EF 6 DB First and DTO design pattern over to ASP.NET Core and EF Core using DB First in the DAL without a problem. It went better than expected.
Maybe, you may also want to try those patterns too in your learning process.
After I saw what was happening in the above tutorial, using EF Core DB First was a piece of cake.