Connecting String Tips with EF5 and localdb

Connection String Reference from Class Constructor When specifying a connection string property use the ‘name’ key word within contructure which instructs EF5 to throw an exception if it doesn’t find it. I would say this is better practice than not specifying the key word ‘name’. public class ApplicationDB:DbContext { publicApplicationDB() : base(“name=EF5.Demo“) {} } Specifying… Continue reading Connecting String Tips with EF5 and localdb

Error: A file activation error occurred. CREATE DATABASE failed.

A file activation error occurred. CREATE DATABASE failed. With Entity Framework 5 I was trying to play around with the enhancements to code first and establish a database with the AttachDbFileName property in the connection string section in the AppConfig file. addname=“DatabaseName“providerName=“System.Data.SqlClient“connectionString=“Data Source=(LocalDB)v11.0;AttachDbFileName=|DataDirectory|DatabaseName.mdf;Integrated Security=True;MultipleActiveResultSets=True“ /> And I was receiving this error message: A file activation… Continue reading Error: A file activation error occurred. CREATE DATABASE failed.