Questions tagged as 'entity-framework'

2
answers

Stored Procedure in the Entity Framework without model edmx

I have a project that uses the Entity Framework without a edmx template, we have registered entities manually create a class and insert it into the context. Does anyone use this format and know how to register a Stored Procedure this...
asked by 29.01.2014 / 19:02
1
answer

Auto Relationship in EF

I'm having the following problem when creating two auto relationships. When you run the Update-Database the following error message appears:    Unable to determine the main end of an association between the   types 'Autorelação.Franquia'...
asked by 28.07.2016 / 15:49
2
answers

EF6 + PostGresql - 22021: invalid byte sequence for encoding \ "UTF8 \": 0xc9 0x52

I am trying to get data from a PostGreSql database with SQL_ASCII Enconding, however in some records I get the error message 22021: invalid byte sequence for encoding \ "UTF8 \": 0xc9 0x52 " / p> I have tried to set the Enconding in the conne...
asked by 04.06.2016 / 22:10
2
answers

Sort DateTime field only by Date part

I have a property of an entity that is of type DateTime? and in SQL Server it is of type datetime also. I need to make a query that sort by date, but without considering the time, because in that specific view will not show the tim...
asked by 22.12.2016 / 18:00
2
answers

How is the generated query created in Linq when we do UPDATE?

How is the generated query created in Linq when we do UPDATE? using ColWebDBContext.DBase.Banco; using System; using System.Web.UI; using System.Linq; namespace DBContext { public partial class _Default : Page { protected void...
asked by 28.10.2016 / 20:24
2
answers

Simplify LINQ Query with Contains

I have two questions regarding LINQ queries below: { //lista de itens do orçamento var ids = itensOrcamento.Select(p => p.Id); //Produtos - todos produtos cadastrados var produtos = Produtos.Where(p => ids.Contains(p...
asked by 31.12.2015 / 21:36
1
answer

Add property in relation to N-N

How to add properties (columns) in an N-N relation using EF? For example, I have class Produto : public class Produto { [Key] public int ProdutoID { get; set; } public string Descricao { get; set; } public decimal Valo...
asked by 12.03.2015 / 14:10
1
answer

The entity or complex type '*' can not be constructed in a LINQ to Entities query

I can not do this? public List<Filial> GetAll() { //Mostra todos os registros incluindo os desativados para os Administradores var ret = _db.Filiais.AsNoTracking() .Where(e => e.Visible) .Orde...
asked by 07.02.2017 / 15:48
1
answer

Doubt about Many-to-Many Relationship EF

I am doubtful in a following Rule: I have N Products and N Coins. From this relationship I will have the ProductMode table: ProdutoMoeda Id - ProdutoId - MoedaID - Nome 1 2 1 ProdutoNome + MoedaNome 2 1 1...
asked by 17.05.2017 / 17:47
2
answers

Problem connecting to SQL Server 2012 database in IIS

I can not run queries from my system in IIS, when I run in Visual Studio I get the result quietly. The error I get when trying to do something is as follows:    System.Data.Entity.Core.ProviderIncompatibleException: An error   occurred whi...
asked by 22.03.2014 / 03:06