I created a Code-first , Entity-framework 6 console app project.
It is very simple - it just creates a database table. It all works, but the database created doesnt appear under: Server Explorer > Data Connections.
I tried the 'Add Connection' option within Server Explorer, but I couldn't figure out which option to choose. I have included my code, can anyone suggest how I can get the database to appear in Server Explorer (I want to visualise the db tables graphically)?
I thought maybe I hadnt installed something or not set something up properly.
I have checked the registry and LocalDB is installed.
I am on Visual Studio 2012. I have also tried it on Visual Studio 2013.
My connectionStirng in app.config:
<connectionStrings> <add name="DatabaseContext2" connectionString="Data Source=(LocalDb)\v11.0; Initial Catalog=DatabaseContext2; Integrated Security=SSPI;" providerName="System.Data.SqlClient"/></connectionStrings>
My c# code...
class Program { static void Main(string[] args) { var db = new DatabaseContext2(); db.PeopleTable1.Add(new Person { FirstName = "Joe", LastName = "Bloggs0" }); db.SaveChanges(); } } public class DatabaseContext2 : System.Data.Entity.DbContext { public DbSet<Person> PeopleTable1 { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); } } public class Person { public int ID {get; set;} public String FirstName { get; set; } public String LastName { get; set; } }