Questions tagged as 'entity-framework-6'

2
answers

LINQ query with sum

I have the following query in LINQ var dados = _db.Contratos .Where(a => a.Adesoes.Any(b => b.Pago)) .Select(a => new { Contrato = a.Numero, ValorTASenior = a.Adesoes.Where(b => b.Pago).Sum(b => b.Val...
asked by 14.12.2017 / 17:19
1
answer

Update on 2mil records Customers how to do a single update instead of 2k separately

I have a Client Model and need to update on EnviadoEmailCobranca para 0 I'm doing this: var clientes = db.Clientes.Where(w => w.Status == 4); foreach (var item in clientes) { item.EnviadoEmailCobranca = false;...
asked by 10.03.2016 / 16:14
1
answer

Best Practices when modulating an application with EF and multi-bank

Let's say I want to model an application in .NET using EntityFramework as ORM and use one of its advantages, be "generic" for several RDBMS . So, for example, I want my application to accept working with Firebird ,...
asked by 09.05.2014 / 03:23
2
answers

What to do when a model has N responsibilities

My system exists a class that is currently a common class for various situations, below some of the other models to exemplify public class Servico { public int Id {get;set;} public string Nome {get;set;} public decimal? Valor {get;set...
asked by 25.11.2015 / 04:55
1
answer

Problem saving a change using Entity Framework

I'm trying to persist a change I make in a registry, but I'm getting this error:    System.InvalidOperationException: 'A referential integrity constraint   violation occurred: The property value (s) of   'UnitMedida.UndMedidaId' on one end of...
asked by 31.05.2017 / 15:19
2
answers

Entity Framework 6 does not create database

I created a C # WEB MVC5 project in Visual Studio 2013, installed the entity framework 6 and created my classes ("entities") as well as the DBContext with their DBsets. Within WEB.Config I configured my connection string and in the DBContext...
asked by 26.11.2014 / 11:52
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
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
2
answers

How to create a non-repeating sequential number per user

Work on a bill invoice project, in this project there is the Emissor entity. My database Sql-Server may have multiple emitters. Each issuer can issue its invoices. Each invoice must have a unique, sequential number. This seque...
asked by 14.03.2018 / 19:16
1
answer

What can cause EF performance to fall in this scenario?

I've been doing a data import for a project in ASP.NET MVC 5 with EF 6.1 and SQL Server 2008 where the source Import data was a txt file. The file record lines were not very large but contained a certain amount of information to proce...
asked by 20.06.2014 / 03:11