Questions tagged as 'linq'

1
answer

How to merge sublists of a class and return the result using Linq and C #

Hello, I'm working with C # and I have the following situation: I have 2 classes in the system, Order and ProductSold ; Order contains as property List<ProductSold> ; In a given ViewModel, I have to get a...
asked by 20.07.2018 / 14:18
2
answers

Return an object coming from two or more tables the fields

I have done some posts about rest and lambda, and to give an end to this subject (hopefully), I have a question. A colleague here on the site recommended that I create a DTO and bring the database data based on this DTO class and not directly fr...
asked by 27.08.2017 / 23:27
1
answer

Delete a foreach and replace the result in a lambda expression in a method

The thing is very simple indeed. I have a method that takes a name inside a database and compares with the parameter passed in the method and being is equal, return it in the method, otherwise return a string.Empty . It turns out, I'm havi...
asked by 20.07.2017 / 14:52
1
answer

Error using GROUP via LINQ

I'm trying to perform the query below: var query = from s in db.Crm_Analise where s.cliente_CRM == cod_cli group s by s.TAG into g select new...
asked by 14.07.2017 / 18:20
1
answer

Check for list records in the entity framework

I have the following code: var ret = Monitoramento.List .Include(p => p.CD) .ThenInclude(p => p.CargaEntrega) .ThenInclude(p => p.CargaEntrega.Motorista) .ThenInclude(p => p.CargaEntr...
asked by 13.07.2017 / 16:50
1
answer

Linq to Entities x Lambda Expression

What's the difference between Linq to Entities and Lambda Expression? Is Linq to Entities still used in the Entity Framework or is there something newer?     
asked by 30.04.2017 / 13:21
1
answer

How to interpret * in this query

I have here a% w / o%, which apparently is simple if it were not for the fact that I have these query ai, which I can not tell whether it is * , inner join or some other in the same family . I need to convert this left...
asked by 16.05.2017 / 17:44
2
answers

How to leave the json of two or more object classes at the same level in Asp.Net MVC

I have 3 classes being them Contact, Sector, Unit so I have Contact with one-to-many relationship with Sector and Unit generating Json with many layers, making it impossible for JQuery Bootgrid to access these fields. Checking JQuery Bootgrid...
asked by 24.02.2017 / 00:24
1
answer

modeling 0..1 to 1 in the Entity Framework - Error The entity or complex

I'm trying to make a linq query, but it returns the error:    Additional information: The entity or complex type   'WMB.Celielo.Model.CieloToken' can not be constructed in a LINQ to   Entities query. My query: var temp = (from tok i...
asked by 05.04.2016 / 18:40
1
answer

SUM within SUM Entity Framework perfomance

I've done a query with entity framework and I'm having performance issues. public static Decimal ValorPrevisto(this ClinicaModel clinica) { return clinica.Contratos.Sum(c => c.Mensalidades.Where(m => m.Pagamento != n...
asked by 18.03.2016 / 04:22