Visual Studio 2019, C#
I'm working on my first code first implementation.
I built out a data access layer which works great. I then went to add/test out a data migration.
I created a migration file then went to the package manager console and ran this:
update-database
after a long pause I saw a message that stated:
Target database is: 'OMDB' (DataSource: (localdb)\mssqllocaldb, Provider: System.Data.SqlClient, Origin: Convention).
OMDB is my model. However, I'm not pointing it to localDB in my app.config, I'm pointing to sqlexpress:
….
<connectionStrings>
<add name="OMDB" connectionString="data source=.\SQLEXPRESS;initial catalog=MyDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value ="data source=.\SQLEXPRESS;initial catalog=MyDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
…
In order to get the data access layer built out, I had to add an override to the class constructor to load the connection string:
public OMDB(string szConnectionString) : base(szConnectionString)
{ }
But I don't think that has anything to do with my issue...
I have the default project set to the data access layer project (DAL), I also tried forcing that on the update-database line:
update-database -Verbose -ProjectName DAL
I did a global search for localDB in my solution and it came up with no hits so I have no idea where it's getting the idea of it using the localdb for the source...?
Any suggestions on where it's pulling up the localDB for this connection?
appsettings.jsonfile?