public ICollection <ContactsApplicationMapping> GetContactsByCriteria(QueryCmpNew query) { List <ContactsApplicationMapping> listContacts = null; using (var dbcontext = new FAXPECContext()) { using (var oCmd = dbcontext.Database.Connection.CreateCommand()) { oCmd.CommandText = cmdSelectRoot + TranslateQuery(query, oCmd); try { using (var r = oCmd.ExecuteReader()) { if (r.HasRows) { listContacts = new List <ContactsApplicationMapping>(); while (r.Read()) { listContacts.Add(DaoSQLServerDBHelper.MapToContactsApplication(r)); } } } } catch { //todo throw; } } } return(listContacts); }