Questions tagged as 'linq'

2
answers

How to concatenate strings in a Linq query

How do I concatenate the column Sistemas , leaving Sistema, Sistemas 2 ? I have this query Linq : var fiscalizacoesBaixadas = (from tb_fiscalizacoes_campo in _context.TB_FISCALIZACOES_CAMPO join tb_fiscalizaco...
asked by 20.12.2014 / 18:08
1
answer

Error calculating difference between dates in Entity with Linq to Entities

Before this was my expression: var resultado = db.T_CRM_StatusPDV .Join(db.T_PDV, t1 => t1.DE_Cnpj, t2 => t2.CNPJ, (t1, t2) => new { t1, t2}) .Where(dt => (TimeSpan)((dt.t...
asked by 06.06.2014 / 21:10
2
answers

Linq C # with order

I have a LINQ query that lists the birthdays of the current month: Ramal[] RamalAniver = (from a in db.Ramais where a.sAniversario.Contains(DiaAniversario + "/" + MesAniversario) && a.bAtivo == tr...
asked by 07.11.2017 / 21:10
1
answer

LINQ to SQL InheritanceMappingAttribute property Code

What is the purpose of the Code property of the InheritanceMappingAttribute attribute? The documentation describes this way:    This property holds a value that appears in the database table in the% col% of column to indicate...
asked by 22.04.2016 / 16:46
0
answers

doubt conditions from Linq to Sql [closed]

I have a GridView with certain products and a Quantity DropDown for each. In an event onClick , the products with quantity > 0. The problem is when I have a table "order details", and I invoke it with Linq to SQL. My goal was to comp...
asked by 23.10.2014 / 19:51
2
answers

Using IEnumerable

I saw an example in another post about using IEnumerable var ent = new EntFuncionarios(); IEnumerable<Funcionario> funcionario = ent.Funcionarios; IEnumerable<Funcionario> temp = funcionario.Where(x => x.FuncID == 2).ToL...
asked by 20.11.2014 / 19:45
1
answer

Remove "OR" condition from LINQ query

I have the following method: bool naoUsarNomeCliente = String.IsNullOrWhiteSpace(filtro.NomeCliente); long codigoExterno; bool naoUsarCodigoExterno = !long.TryParse(filtro.CodigoExterno, out codigoExterno); bool naoUsar...
asked by 09.06.2017 / 21:05
2
answers

What is the difference between ToListAsync () and ToList ()?

What is the difference between ToListAsync() and ToList() ? As in the example below, what is the difference between one and the other? using Modelo.Classes.Contexto; using System.Data.Entity; using System.Linq; namespace AppCo...
asked by 05.12.2016 / 15:52
2
answers

What is the most efficient way to clean a List (List) with C #?

I have a scenario here where I create a list to check some items, and I need to clear this list inside the loop, and I had some doubts about performance Should I check the list before cleaning? ( .Any() ou .Count > 0 ? ) to not exe...
asked by 12.02.2018 / 10:46
3
answers

Why do you print the variable type instead of the result?

See the method below: public void TesteLambda() { List<String> selecoes = new List<string>(); selecoes.Add("USA"); selecoes.Add("Brasil"); selecoes.Add("Itália"); selecoes...
asked by 17.08.2017 / 08:52