Fluent API and annotations are you two options when it comes to controling mappings and configuring constraints such as field length or required. When configured these constraints it will affect the database that is created by Code First as well as the validation that is done by Entity Framework. Some reasons to favour fluent APIs:… Continue reading Enity Framework Fluent APIs
Month: November 2012
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.
Visual Stuido and IntelliTrace gotcha
I was trouble shooting the ability to create a localdb database using Entity Framework and Visual Studio when I found that I had waisted over an hour because I didn’t understand the fundamentals of IntelliTrace. When the error popped up I immediately went to the first Exception at the top of the IntelliTrace log and… Continue reading Visual Stuido and IntelliTrace gotcha
Why some people are reluctant to share knowledge
Lincoln De Kalb, a colleage at work sent through this link http://www.rajeshsetty.com/2009/12/26/why-some-smart-people-are-reluctant-to-share/ which was a great read and quite valuable in thinking through potential approachs in facilitating senior team members in sharing knowledge with non senior members of the team.