Convert Query SQL Server to Entity Framework

Asked

Viewed 148 times

1

How to convert a SQL of SQL Server for Entity Framework, Ordering field values as follows:

of:

({'115-F-G', '10 -H-G ', '98 -T-R'}) 

for:

('10 -H-G ','98 -T-R','115-F-G')

SELECT * FROM ReportePedido Where PedidoId = 145
Order By TipoProducto, 
         CONVERT(INT, SUBSTRING(EnderecoEstoque, 0, CHARINDEX('-',EnderecoEstoque,1)))

1 answer

0

That would be the query:

var res = (from x in Contexto.Set<ReportePedido>()
                  where x.PedidoId == 145
                  orderby x.EnderecoEstoque.Substring(0, x.EnderecoEstoque.IndexOf('-'))
                  select x);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.