Equivalent d'une requete SQL sur EntityFrameWork
Bonjour,
voici une requete en langage SQL :
Code:
1 2 3 4 5 6 7
| select *
from ERP_PROD..ER2.GCFAM_CPTA
where FAMC_TYPE = 'T'
order by
case
when FAMC_CODE like 'C%' then 0
else 1 end; |
je voudrais faire la même chose avec EntityFrameWork dans un projet WPF :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public static void GetFam_Cpta(ComboBox cb)
{
using (OracleEntities dc = new OracleEntities())
{
cb.ItemsSource = (from f in dc.GCFAM_CPTA.AsEnumerable()
where f.FAMC_TYPE == "T"
orderby // comment ecrire le case when de SQL ??
select new
{
f.FAMC_CODE,
f.FAMC_LIBELLE,
t = string.Join("-", f.FAMC_CODE, f.FAMC_LIBELLE)
}).ToList();
cb.DisplayMemberPath = "t";
cb.SelectedValuePath = "FAMC_CODE";
dc.Dispose();
}
} |
Merci de votre aide.