Questions tagged as 'linq'

1
answer

Help with Query in Linq C #

I have a message table in the following scheme: Id | osID |Interessado | Remetente | Destinatario | Msg -------------------------------------------------- 1 | 2 |João | João | Maria |bla bla bla... 2 | 2 |João...
asked by 30.10.2018 / 17:51
1
answer

Generate list dynamically with Linq

I have an API that uses DotNet dynamic to generate the tickets. The documentation is as follows: dynamic endpoints = new Endpoints("client_id", "client_secret", true); var body = new { items = new[] { new { name = "Primeiro item d...
asked by 30.11.2018 / 12:50
1
answer

Extraction of data other than two lists of objects [closed]

I'm working on a WEB API and need to remove some of the values contained in one list and that are contained in another. To be better illustrated would be the equivalent of removing the data from a list where the user in question has already regi...
asked by 16.08.2018 / 03:08
1
answer

C # - AsQueryable - Condition (Linq - Lambda)

In this method, I populate my 'rule' variable with all rules coming from Select, but I'd like to filter only the Status = True. How to do this? public async Task<BootgridResponseViewModel<ConsultaIntramexRegrasResponse>> ObterLis...
asked by 15.06.2018 / 15:11
1
answer

Where to query using multiple properties of a list

I have the following scenario public Teste[] GetTestes(List<TesteDTO> testeDTOs){ IQueryble<Teste> query = GetAll<Teste>(); //where ... } public class Teste() { public int Prop1{ get; set;} public int P...
asked by 03.05.2018 / 20:57
1
answer

Linq to Objects - Performance

When looking for good practice content when doing LINQ I came across the following filter situation: // Filtros int idBairro = 8626; 1st way: IQueryable<TesteConsulta> queryCidade = (from c in db.ERPCEPCidade...
asked by 04.04.2018 / 20:32
1
answer

Error selecting part of a string in select of an entity using Entity Framework and Linq

I need to mount a drop-down with part of the name of a project, which is very large in the database, going up to 250 characters. For this I made a selector like this: var lista = _projetoAppServ.ObterTodos("Descricao") .Select( a => n...
asked by 30.11.2017 / 13:30
1
answer

XML Query with Linq

I need to read a specific part of an XML (highlighted in red), and for this I'm using LINQ. I'm using the following code, but I do not think I wrote it in the best way. IEnumerable<string> teste = from item in XERetornoConsulta.Descen...
asked by 12.09.2017 / 17:30
1
answer

Upload list with entity

The following. I created a context class inherited from DbContext . public class SiloContext : DbContext { public SiloContext() : base("inetConn") { } public DbSet<Produto> Produtos...
asked by 11.08.2017 / 16:53
1
answer

How to convert SQL command to LINQ?

I have two classes: Produção { int id, procedimento int, quant int string competencia } bpi { int id, ini idProducao } How to convert the code below to LINQ ? select ((sum(procedimento) + sum(quant)) mod 1111) + 1111 from producao...
asked by 12.03.2017 / 20:53