I am using POCO approach on all my projects using Entity Framework. It's all good but I have one problem: It is creating database on my SQL Express, instead I want it to store my database in *.mdf file in App_Data folder.
Set an appropriate connection string in Web.config that makes use of the AttachDBFilename keyword.
<connectionStrings>
<add name="MyContextClassName"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=True;MultipleActiveResultSets=True;AttachDBFilename=|DataDirectory|MyDatabase.mdf;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With