Question

Entity Framework is being used to build a basic project for me. Before I installed a fresh copy of Windows, it would run and load all of my databases.

I was using Entity Framework 6.1.3, target.NET 4.5.2, Visual Studio 2015, Windows 10 and SQL Server 2016.

I reinstalled Windows 10 along with everything else.

I connected my phone through data to my.mdf I can read the database from the file in my Visual Studio Server Explorer and confirm that all the entries are there in my tables.

I get the following problem when I execute the project:

"An exception of type 'System.NullReferenceException' occurred in myApp.exe but was not handled in user code"

It is reading a list that ought to be filled up using one of my entity characteristics, which is why this is occurring.

What happens when I construct myDbContext Why, for instance, do none of the entities or their characteristics load?

Any ideas?

EDIT: The connection string is as follows.

" Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="F:\Files\Development\C#\Visual Studio 2015\Projects\NurseOfficeApp\NurseOfficeApp\DB\NurseOfficeApp.NurseOfficeContext.mdf";Integrated Security=True;Connect Timeout=30"

This is the issue I have.

private void FrmDesignAgency_Load(object sender, EventArgs e)
{
     _context = new NurseOfficeContext();
     var mylist = _context.Set<Agency>().ToList();// mylist.count = 0
     ...

mylist.count should not be zero

1
0
6/10/2017 8:42:32 PM

Popular Answer

ZZZ_tmp
0
6/9/2017 1:33:06 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow