I need to convert a query similar to this.
But I need to call a native SQL Server functions (conversion, system, ...).
How can I call them using Entity Framework?
Below is an example of the query.
select
tbf.nr_list, tbf.cd_lne, tbf.nr_seq, tbf.cd_ref,
case
when tbri.ds_referencia IS null
then tbf.ds_referencia
else tbri.ds_referencia
end as Ds_Ref,
'' as Ds_Med,
cast(tbf.qt_tec as MONEY) as Qt_Tec,
isnull(tbf.qt_width, 0) as Qt_Width,
isnull(tbf.qt_height, 0) as Qt_Height,
case
when tbra.ds_lne IS null
then 'null'
when right(tbra.ds_lne, 1) = 'X'
then 'x'
when right(tbra.ds_lne, 1) = 'Y'
then 'y'
else tbra.ds_lne
end as Ds_Lne,
tbro.im_pic as Im_Pic,
'' as Cd_Compos1,
0.00 as Vl_Compos1,
rl.dt_end,
'' as Ds_Con,
0.00 as Al_Mar
from
table_from tbf
left join
table_ref_udao tbru on (tbru.nr_list = tbf.nr_list and tbru.cd_lne = tbf.cd_lne)
left join
table_ref_odae tbro on (tbro.nr_list = tbf.nr_list
and tbro.cd_lne = tbf.cd_lne
and tbro.nr_seq = 1)
left join
table_ref_adeo tbra on (tbra.nr_list = tbf.nr_list and tbra.cd_lne = tbf.cd_lne)
left join
table_ref_idio tbri on (tbri.nr_list = tbf.nr_list
and tbri.cd_lne = tbf.cd_lne
and tbri.nr_seq = tbf.nr_seq
and tbri.cd_ref = tbf.cd_ref
and tbri.cd_idi = tbf.cd_idi)
left join
rom_lista rl on(tbru.nr_list = rl.nr_list)
where
tbf.nr_list = '59846'
order by
tbru.ds_lne, tbf.nr_seq