Code First: Entity accessible in tests, but “not set to an instance of an object” outside of tests
问题 I created an EF Code First Entity for a view in my database. I setup a test, and the access code works in my test, but when I run the code outside of the test, it throws "Object Reference not set to an instance of an object". I am stuck, as I cannot understand what could be causing the issue. Any ideas on why it's throwing an error? Here is my entity class: using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema;