private static void ExecuteOnFederationMember(string id, Action <UsersEntities, int> action) { try { using (var context = new UsersEntities()) { ((IObjectContextAdapter)context).ObjectContext.Connection.Open(); var partitionId = Partitioner.PartitionId(id); //Partitioner.SwitchConnectionToUsersFederationMember(context, partitionId); action(context, partitionId); } } catch (Exception exception) { Console.WriteLine(exception); throw; } }