I have 2 solutions, using EF 6.0 and both use the exact same default configuration. Still, they connect to 2 different data sources!? (localdb)\mssqllocaldb and .\SQLEXPRESS.
My configuration:
<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>
The DbContext is also similar for both:
public class PlusUltraContext : DbContext
{
public PlusUltraContext() : base("PlusUltra")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
base.OnModelCreating(modelBuilder);
}
public DbSet<Models.Article> Articles { get; set; }
public DbSet<Models.ArticleComment> Comments { get; set; }
}
vs
public class InvoicingContext : DbContext
{
public DbSet<Address> Addresses { get; set; }
public DbSet<Company> Companies { get; set; }
public DbSet<Country> Countries { get; set; }
public DbSet<Currency> Currencies { get; set; }
public DbSet<Invoice> Invoices { get; set; }
public DbSet<InvoiceLine> InvoiceLines { get; set; }
public DbSet<Person> Persons { get; set; }
public DbSet<Unit> Units { get; set; }
public InvoicingContext() : base("Invoicing")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
base.OnModelCreating(modelBuilder);
}
}
However, when I run the Update-Database command, the first project connects to .\SQLEXPRESS, while the other connects to (localdb)\mssqllocaldb
Target database is: 'PlusUltra' (DataSource: (localdb)\mssqllocaldb, Provider: System.Data.SqlClient, Origin: Convention).
vs
Target database is: 'Invoicing' (DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).
My Question
What are some things I can check to see why they behave differently?