Questions tagged as 'linq'

1
answer

Get the largest value inside linq select

Is there any way I can get the highest value of a select do linq field within decimal? , as per the code below? MaxValor = Math.Max(CF.Janeiro, CF.Fevereiro, CF.Marco, CF.Abril, CF.Maio, CF.Junho, CF.Julho, CF.Agosto, CF.Setembro,...
asked by 16.12.2015 / 19:49
1
answer

Name of columns in web service return xml

This line gives me this error: if (db.T_TarefaParceiro.Max(p => p.IDTarefaParceiro) != null) The error The cast to value type 'System.Int32' failed because the materialized value is null. Either the result type's generic parameter or t...
asked by 27.05.2014 / 02:08
2
answers

Filter on where the largest date with LINQ

As I pass in the where of this linq to max datatransaction, ie, I want to bring the result but for the greater date. var resultado = (from ci in webDB.T_Controle_Importacao where ci.CNPJ == cnpj...
asked by 06.05.2014 / 01:13
3
answers

Where are the elements selected by LINQ stored?

I'm studying LINQ now and it hit me a question: A LINQ that runs without the methods ToList() or ToArray() returns a IEnumerable<> , right? But a IEnumerable<> is not exactly a list / array , or is it?...
asked by 21.04.2015 / 05:32
1
answer

How to create a filter with all products in the second list, except with the products that returned in the first list [duplicate]

Perform a filter with the products in the second list, except those that were brought in the first list List List<string> listaProduto = new List<string>(); listaProduto.Add("Arroz"); listaProduto.Add("Feijão"); listaProduto...
asked by 03.11.2017 / 19:20
1
answer

I need help to turn this SQL into a LINQ

I have the following SQL: select conferencia.tb_conferencia.con_codigo, con_pedido, count(coi_codigo) as countItens, count(distinct cic_conferencia_item) as countItensConferidos from conferencia.tb_conferencia left...
asked by 23.08.2017 / 14:58
1
answer

How to create an object in a Linq.Expressions.Expression and dynamically add properties to it in C #

Hello, I am creating a DataAnnotations library to extend the EntityFrameworkCore with structures that today only exist using FluentAPI. In one of them, I'm trying to recreate this block from FluentAPI: using Microsoft.EntityFrameworkCor...
asked by 11.12.2018 / 17:37
1
answer

Doubt in a lambda expression returning "true"

When I do this: List<Tipo1> tipo = await context.MeuMetodo.Find(x => true).ToListAsync(); What am I saying here: (x => true) ?     
asked by 27.06.2018 / 15:12
1
answer

MIgrations, Updating a null field to not null

I'm updating the phone and CPF field of my User entity that was allowing nulls to non-null. follow the migration file public partial class Required_fild_users_cpf_phone : DbMigration { public override void Up() { AlterColumn("d...
asked by 01.12.2017 / 14:38
3
answers

LINQ with JOIN and where clause, how to do?

Good afternoon. I'm trying to make a left outer join (SQL) with LINQ, however, I'm not getting it. The code for my class, this is below. Can anyone give me a light on how to solve this? public class PessoaController : Controller {...
asked by 01.01.2018 / 17:46