Questions tagged as 'linq'

0
answers

Get value from an entity via navigation property

I have a question that seems basic, but I'm breaking my head to solve. How can I get the value of an attribute of an entity via Properties Navigations? For example, I have the classes: public class Budget { public Guid Id {get; set;}...
asked by 17.10.2018 / 21:38
1
answer

Using elements like "Not Exists" and Sub Query in LINQ, LAMBDA EXPRESSION and Nhibernate

Good morning, I have a query to run in my database, but here in our projects we use Nhibernate as an ORM tool. I'm having difficulty passing this SQL query to a syntax used with NHibernate. The query is down: SELECT distinct a.NumContrO...
asked by 06.09.2018 / 14:09
0
answers

How to define the order of a list dynamically using Linq and C #

Hello, I'm creating a method so that I can return a list of people where, I pass the column that should be sorted and whether it is increasing or decreasing. So: public async Task<List<Pessoa>> getAsync() => await getAsync("id"...
asked by 07.08.2018 / 23:22
0
answers

c # linq, select clustered subquery

I'm trying to do a select using linq, but I'm not getting it I need to return a List<AplicacaoAgrupado> Application ClassGroup: public class AplicacaoAgrupado { public virtual Veiculo Veiculo { get; set; }...
asked by 24.07.2018 / 20:45
0
answers

How to transform my query into a Linq query?

I need to mount this query on Entity select ped.Id, prot.Prot_numero as Protocolo, ori.Descricao as Sistema, cla.Id as Equipe, cla.Descricao as Finalidade, forn.Nome as Fornecedor from Pedidos ped join Protocolo prot on ped.ProtocoloId =...
asked by 14.06.2018 / 14:37
0
answers

Union with different dataTypes Linq-to-entities

I'm trying to return a grid! with headers and values below. I'm trying to do this! void Main() { var ctx = dbContext; (from tQuestions in ctx.Questions select new { a1_1 = (Object)tQuestions.HeaderCreationD...
asked by 24.05.2018 / 18:28
1
answer

Collating in LINQ with multiple entity records

I have a LINQ query that retrieves the average of a list of Notes grouped by sources of risk. var mediaControles = await (from ac in _context.AvaliacaoControle join c in _context.Controle on ac.ControleID equals c.ControleID join nc in _con...
asked by 08.05.2018 / 15:12
3
answers

Linq filttar elements of LEFT JOIN

I would like to return an object with your children, but only wanted to bring the children that corresponded to a certain condition. ex: I have the following classes: public class Fornecedor { public int FornecedorID { get; set; }...
asked by 11.11.2016 / 17:29
2
answers

How to use the where clause with linq?

I need to make a join between the person and person tables so that the Entity Framework core brings a corresponding record. I'll be clearer: In the Person Person table, I classify my people record using an enum. I did this to save the Ids of...
asked by 05.04.2018 / 16:55
0
answers

Select set of values inside a LINQ query

Friends, I'm trying to create the following .json with a LINQ query using Entity Framework 6: { "id": "1231-12321-sdff-21-31", "name": "nome do produto", "description": "Descrição do produto" "rating": 4.1, "pr...
asked by 29.03.2018 / 15:58