Questions tagged as 'linq'

2
answers

Help with LINQ, query in .Net

Good morning, guys, I'm in need of help with LINQ. I'm trying to perform the following query through linq: SELECT NFE_SAIDA.NFESAI_SEQUENCIA FROM CAD_NFE_SAIDA NFE_SAIDA LEFT JOIN CAD_NFE_SAIDA_ESTACOES NFE_SAIDA_ESTACOES ON NFE_SA...
asked by 29.12.2017 / 11:37
1
answer

Query using Entityframework Why performance variation?

I have the following querys using Linq to Object: _Context.GerenciaTransacao.Where(x => x.Placa == "LUN1320").ToList(); In this query, results return in 100ms. and string placa = "LUN1320"; _Context.GerenciaTransacao.Where(x =>...
asked by 14.02.2017 / 15:59
2
answers

Conversion specified is not valid

I'm doing a query with LINQ on DataTable in that snippet of code. I have to check if there is already a link for person registered in the database. My query using LINQ is working perfectly, the problem is to store query.C...
asked by 16.10.2015 / 14:54
1
answer

state 'can not be assigned to - it is read only - Entity Framework

Follow the code: var resultado = db.Tabela .Where(l => l.Nome == "João") .Select(l => new { l.numero, l.cidade, l.estado, l.pais }); I know that in the database has "SP" value of the state field and I want to change th...
asked by 15.01.2017 / 02:41
2
answers

SQL query for Linq mvc4 c #

I'm not very familiar with Linq and I'm having trouble turning this SQL query into linq, can anyone help me. I do join of 6 tables (I did not do the database. I have to work with it), what I'm hooked on is group by and having...
asked by 18.11.2016 / 12:29
1
answer

Not In Linq Sql Entity Framework

I need to do this search, but it displays the error:    ambiguous invocation. public List<Notification> Get(List<UserVisualization> item) { return db.Notifications.Select(o=> o.EntityId).Where(o => !item.Contains(o.En...
asked by 10.11.2016 / 19:12
1
answer

How to sort a List of Strings?

I have List<List<string>> and need to sort the main list according to some elements of the secondary see the illustration below. Ineedthefirstleveltobeinalphabeticalorder,andthesecondlevelisinascendingorderbutaccordingtoth...
asked by 30.01.2017 / 23:57
1
answer

How to check if the LINQ expression does not come null

I have this LINQ expression: MaterialImage mainImage = images.First(i => i.IsMainImage == true); My problem is that images.First (i => i.IsMainImage == true) can return null if it has no image with the IsMainImage property checked as...
asked by 04.01.2017 / 20:31
3
answers

Check two or more occurrences of list element (lambda / linq)

I have the following list<t> listCard; inside it I have the following values: [0]:7720890002560 [1]:7720890002560 [2]:7777777002560 [3]:7720890002560 [4]:7720444402560 [5]:7720777002560 [6]:7728888802560 [7]:7727777702560...
asked by 06.04.2017 / 20:55
1
answer

Apply function to all list elements using VB.NET

Is there any function / module for an object of type List in VB.NET that is similar to array_map() of PHP? The idea is to create a new variable with elements that satisfy a given condition. I have a list of objects of type...
asked by 10.07.2015 / 20:43