Entity Framework 4.0 and Multiple Data Contexts

In the EF version 1.0, there was a problem when one would try to update multiple contexts as part of a single transaction.  For example, I can use Transaction Scope, the update one context, then second context.  Here is sample code to illustrate:   using (TransactionScope scope = new TransactionScope()) { try { using (RolodexEntities …

Continue reading ‘Entity Framework 4.0 and Multiple Data Contexts’ »

Entity Framework and multiple relationships between two tables

Here is a scenario – I have two tables – Users and Phones.  Users table has two columns that relate to Phones table – PrimaryPhone and SecondaryPhone.  If you build an EF model with these two tables, you will end up with Users entity with two navigation properties that relate to Phones entity – Phones …

Continue reading ‘Entity Framework and multiple relationships between two tables’ »

Using Entity Framework as Data Access Layer in n-Tier applications

I have been using Entity framework as DAL for a CSLA for Silverlight based application.  I have player a role in uncovering a number of issues that make it very hard to use in these circumstances.  Here is my (surely incomplete) list. 1. Foreign keys handling.  The actual IDs that are used as foreign keys …

Continue reading ‘Using Entity Framework as Data Access Layer in n-Tier applications’ »