I am a little confused on the code first entity framework database.
I created a new DbContext and class that I will be storing in that context, like this:
namespace MyProject.Subproject.Something
{
public class MyItem
{
public string One { get; set; }
public string Two { get; set; }
[Key]
public string Three { get; set; }
public string Four { get; set; }
}
public class MyAppData : DbContext
{
public DbSet<MyItem> MyItems { get; set; }
}
}
I know that it's working since I can do this without failure:
var db = new MyAppData();
MyItem i = new MyItem();
// ... fill in item
db.MyItems.Add(i);
db.SaveChanges();
Additionally, if I restart the application I find db.MyItems.Count()
to reflect that items are in fact persistently stored somewhere.
I'm assuming this is stored in localdb
since I set up no SQL Server database. All I want to be able to do is see the table in localdb
somewhere, however I can't seem to find it.
If I go to Data Sources -> Add New Data Source -> Database -> Data Set -> New Connection -> Microsoft SQL Server
and then put in (localdb)v11.0
for the Server Name and dropdown the list of databases, I do not see MyAppData or MyItems listed.
Edit: What I see in my App.config is <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
Edit 2: Full App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxx" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>