public virtual Dictionary <Guid, E> DataTableToDictionary(DataTable table) { Dictionary <Guid, E> result = new Dictionary <Guid, E>(); foreach (DataRow row in table.Rows) { E e = EntityReader <E> .PopulateFromDataRow(Activator.CreateInstance <E>(), row); Guid surrogateKey = GetSurrogateKeyValue(e); if (_entities.ContainsKey(surrogateKey)) { throw new Exception(string.Format( "May not load more than one {0} with the same Id {1}.", typeof(E).FullName, surrogateKey.ToString())); } result.Add(surrogateKey, e); } return(result); }