Most voted "linq" questions

Language Integrated Query (LINQ) is a component of Microsoft. NET Framework that adds native data query (query) functionality in . NET languages.

Learn more…

578 questions

Sort by count of

  • -1

    votes

    1

    answer

    42

    views

    how to use Dictionary select . value concepts

    what that select and . value means var idProdutosDistintos = DictionaryVendas .Select(x => x.Value.Produto.Codigo) .Distinct() .Count(); sw.WriteLine("E - " + idProdutosDistintos);…

  • -1

    votes

    1

    answer

    154

    views

    Type varbinary sql server attribute with c#

    That column DocumentoPDF until now it was not used by the: I mean I was always null, however at some point added values and then error occurred in my query linq and the problem is that at the moment…

  • -1

    votes

    1

    answer

    79

    views

    Linq to Entities - Count elements of a query referencing two contexts

    I have the following query: var query = (from q1 in query1 join q2 in query1 on q1.idGenerico equals q2.idGenerico into q2Left from q2 in q2Left.DefaultIfEmpty() join q3 in query3 on q2.idGenerico…

  • -1

    votes

    1

    answer

    29

    views

    LINQ query for object with a sub-list

    I have the following structure: public class Insumo{ public int Insumo_id { get; set; } public List<InsumoDados> Dados{ get; set; } } public class InsumoDados{ public int Desc { get; set; }…

  • -1

    votes

    3

    answers

    299

    views

    How to get the amount of "true"?

    Follows code: int total_true = ctx .MinhaTabela .Where(x => x.id == 5) .Select(x => new Tabela_DTO { Campo1 = x.Campo1, // database está como true Campo2 = x.Campo2, //database está como false…

  • -1

    votes

    2

    answers

    94

    views

    doubt with Linq to sql

    Guys, I got two tables, sale and blindfolds: Sale: [Table("venda")] public class VendaModel { [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int id_venda { get; set; }…

  • -1

    votes

    3

    answers

    97

    views

    Search By Entity with EF

    I’m new to the business and I’m on my first steps. I am trying to create a system of financial consolidation. I need it to return me the total expenses of a certain Rubric. using System; using…

  • -1

    votes

    1

    answer

    42

    views

    How to get the amount of multiple properties on a list?

    I have a list that has over 10,000 Curriculum Grades. Within Curriculum Grade I have the name of the Discipline and the Teaching that it is There are 15 subjects that can be repeated for each…

  • -1

    votes

    1

    answer

    250

    views

    Search log by Cpf ASP . NET CORE 3.0

    I created a simple CRUD using ASP . NET CORE 3.0 using EF. All basic CRUD operations are running normal. I tried to create a method manually to search a record by the client’s CPF as code below, but…

  • -1

    votes

    1

    answer

    26

    views

    Search from a property in a list of a certain class

    I am trying to filter the results from a property of a class, within a list. Today I have the following structure : public class Jogo { public int Id { get; set; } public string Titulo { get; set; }…

  • -2

    votes

    1

    answer

    341

    views

    lambda expression gives conversion error

    This is my lambda ring: public JsonResult CarregaDescricaoRede(string _tipo_rede, string _uf, string _cidade) { var resultado_rede_descricao = (from _pdv in db.PDV .Where(r => r.Tipo_PDV ==…

  • -2

    votes

    1

    answer

    651

    views

    Convert Datetime to Date

    I need to compare a date without the time, only ("dd/MM/yyyy") with the database with Linq, but I’m not able to transform the format DateTime("dd/MM/yyyy HH:mm:s") for Date("dd/MM/yyyy")?…

  • -2

    votes

    1

    answer

    55

    views

    Turn float or double into date within a lambda

    In BD you have a field with a float value, which is actually the number of days from the date 28/12/1800, that the Clarion programming language stores. Well, I have a service REST that is consumed…

  • -2

    votes

    1

    answer

    385

    views

    Compare lists that are exactly the same

    I’m trying to implement a list comparison method that checks if they are equal. It must return true when the two lists passed by parameter are exactly equal (number of elements, elements and…

  • -2

    votes

    1

    answer

    50

    views

    How do I order a Complex List?

    How do I sort a complex list ? I have this list below and I need to sort by Nometype and Nomesubtype: public class Tipo() { public int IdTipo {get; set;} public string NomeTipo {get; set;} public…

  • -2

    votes

    2

    answers

    65

    views

    I’m trying to do a research boot on my view, but tell me it can’t be null

    I’m trying to make a search button on mine view of films, but gives me a mistake to say that I can’t have a zero value. Why? And what do I have to do? Controller: public ActionResult Index(string…

  • -2

    votes

    1

    answer

    432

    views

    Consultation Group by Linq

    It would be possible to consult the table below in a single query? It would be a group by query using Context with Entity Framework where: The 3 customers who spent the most on services per month in…

  • -2

    votes

    1

    answer

    32

    views

    Error comparing database data with empty form field

    I need to check if there is already a registered document number not to repeat it. However, the field Document allows null, so there is an error when comparing a database value with a null value of…

  • -2

    votes

    1

    answer

    43

    views

    How to do multiple Where validations with Linq and Mongo in c#

    I am developing an Api and in my GET method can be passed word to be searched, start date and end date. However all fields are optional, that is, I can pass only the word without date, I can pass…

  • -3

    votes

    1

    answer

    1703

    views

    Bring the last five in a row

    I have a table of events. And each POS, an event is held, with the Event ID, Date, User and Type. Well, whenever I make a query, I populate an event grid. I would like to know, how to bring the last…