Currently my SQL database is on
C:\Users\Slaven\KasaMP.mdf
I want to move it into my projects directory [maybe "database" folder(?)] and make correct changes on my connectionstring. My goal is to be able to open this project with .mdf file attached on any computer. Current ConnectionString I use is EntityFramework generated and I am not sure what is the approach to make this CS point to different location.
ConnectionString:
<connectionStrings>
<add name="KasaMPEntities" connectionString="metadata=res://*/OsnovniPodaci.Model.csdl|res://*/OsnovniPodaci.Model.ssdl|res://*/OsnovniPodaci.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=(localdb)\v11.0;AttachDbFilename=|DataDirectory|\KasaMP.mdf;initial catalog=KasaMP;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
My projects path:
C:\Users\Slaven\Documents\visual studio 2013\Projects\PCKasa\KasaMP
I found in other posts this following line but I'm not sure what it does:
AppDomain.CurrentDomain.SetData("DataDirectory", System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database"));
I know I have to place this attribute somewhere in the ConnectionString
AttachDbFileName=|DataDirectory|\KasaMP.mdf
Any suggestions on how to correctly do this? ^ ^