I need to support SQL Express and LocalDb in my ASP.NET application. This is a sample app for demo purposes and not a real website.
Currently the app is shipped with LocalDb connection string:
<add name="Conn"
connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=SampleDB;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\SampleDB.mdf"
providerName="System.Data.SqlClient" />
If user has SQL Express installed only, he must update the connection string to be:
<add name="Conn"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\SampleDB.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
Is it possible to specify connection string so that both SQL Express and SQL LocalDb are supported and user do not need to update the connection string?
I can update my sample application to test Sql Express and Local DB presence and choose the required string automatically, but want to avoid this, because I need to keep the app as simple as possible with minimum code.