Questions tagged as 'linq-to-entities'

1
answer

Problem returning Entity models: "The entity or complex type ... can not be constructed in a LINQ to Entities query"

I'm trying to return a list of objects generated by the DataBase First of the Entity Framework but I get this error:   The entity or complex type 'leaosites04Model.TB_LEMBRETES' can not be constructed in a LINQ to Entities query. I'm tryi...
asked by 03.07.2014 / 10:49
1
answer

Search for missing records range

Imagine the following situation: a table looks like this: Id (int) - Codigo (int) - Descricao (varchar) 1 - 01 - Descrição 1 2 - 03 - Descrição 2 3 - 04 - Descrição 3 4 - 05 -...
asked by 23.08.2018 / 15:18
1
answer

error with EF and Mysql query

I have the following query: var produto = (from a in context.ItensReceita join b in context.Receita on a.t0080_id_receita equals b.t0080_id_receita join c in context.Medicamento on a.t0080_id_receita equals c.t...
asked by 09.02.2017 / 11:15
1
answer

Convert SQL script to Linq

I need to convert the SQL script below to Linq. SELECT [ID_Pessoa], [ID_ArquivoPagamento], SUM([Peculio_Valor]) AS 'Peculio_Valor' FROM [VW_PESSOA] WHERE [ID_Pessoa] = @ID_Pessoa AND [ID_ArquivoPagamento] = @ID_Arq...
asked by 08.12.2015 / 19:03
2
answers

Help with LINQ, query in .Net

Good morning, guys, I'm in need of help with LINQ. I'm trying to perform the following query through linq: SELECT NFE_SAIDA.NFESAI_SEQUENCIA FROM CAD_NFE_SAIDA NFE_SAIDA LEFT JOIN CAD_NFE_SAIDA_ESTACOES NFE_SAIDA_ESTACOES ON NFE_SA...
asked by 29.12.2017 / 11:37
1
answer

What's the difference between using "equals" vs == in LINQ to Entities?

As I mentioned above, when I say equals of LINQ to Entities I'm referring specifically to the C # reserved word and not to Equals() of System.Object . Source: equals (C # Reference) The following example returns all...
asked by 06.12.2018 / 23:34
1
answer

Save IEnumerableT inside a parent entity with LINQ

Dear, I have the following classes: public class Foto { [Key] public int Id { get; set; } [StringLength(500)] [Required(ErrorMessage = "Obrigatório")] public string Nome { get; set; } public int Item...
asked by 14.01.2016 / 14:36
1
answer

How do I add more than two conditions to an Expression dynamically?

I need to pass a list of Expressions as a parameter and create the 'Ands' as dynamically as possible. So, whenever I add a new Expression to the list, I will have to change the class that mounts Expression as well. Para...
asked by 21.08.2015 / 15:47
1
answer

How do I search for the record when the table has composite primary key?

I have in my database the table t_command_control . This table has a composite primary key formed by the CD_STATION and CD_COMMAND fields. If the primary key was simple (just as CD_STATION field) I would use the...
asked by 30.11.2014 / 18:50
1
answer

IQueryable select data from multiple tables

I have a queryable linq to entities ) in the EntityFramework and I am not able to pull data from two or more tables. For example: var model = _service.List().Where(m => m.DS_GRUPO.Contains(searchString)).Select(m => new { m.PK_GRUPO,...
asked by 15.08.2014 / 21:49