Questions tagged as 'entity-framework'

2
answers

Is there an alternative to RemoveAt?

I'm using Entity Framework in an Asp.Net MVC project where I have a simple list of strings and need to remove only the first item. I used the following command: minhaLista.RemoveAt(0); Well, but using a Visual Studio performance tool, I...
asked by 10.02.2016 / 21:02
2
answers

Code First and Calculated Fields

I have a class Pedido , which has a calculated field, which is the value of the request, consisting of the sum of the items minus the discount. public class Pedido { public ICollection<PedidoItem> Itens { get; set; } publi...
asked by 25.11.2015 / 14:23
3
answers

LINQ with condition in where using variable

I have the following table: USUARIO Nome | Idade João | 21 Maria | 18 I want to make only one query that returns all users, or only returns users of a specific age based on a C # variable. Also by name. int idade = 18;...
asked by 26.08.2015 / 22:01
2
answers

Entity Framework - Bank Compatibility

I was reading a article > which demonstrates the method of using the Entity Framework to connect to MySQL database, however, the article demonstrates techniques very different from the ones I use. (MVC). Currently my applications are based...
asked by 13.08.2014 / 15:05
1
answer

Queries in asp.net mvc with entity framework

I'm starting a project in ASP.NET MVC 5 with Entity Framework 6 , along with mvc studies. This to have a better learning, and I came across the following doubt. In the controller I have the Index method, which literally returns a " se...
asked by 13.09.2014 / 01:06
3
answers

How to intercept exceptions when working with the Entity Framework?

I want to handle the errors returned by the Entity Framework. In this example I'm forcing the insertion of a duplicate record (Name already in the database where the column of the table is configured as a Unique Index ): [HttpPost] [Validat...
asked by 13.06.2014 / 02:31
4
answers

Good practices in using DB connections via Entity Framework

When defining the context class in the Entity Framework (example): public class Context : DbContext { public DbSet<Usuario> Usuarios { get; set; } public DbSet<Categoria> Categorias { get; set; } } And used in DAO classe...
asked by 25.02.2014 / 17:12
2
answers

How do I convert LINQ to SQL for MySQL?

I'm trying to remove the use of SQL statements from within the system (to make it flexible on the database that will be used), I use statements Insert , Update and Delete via stored procedure (for performance and for flexibi...
asked by 28.01.2015 / 14:57
2
answers

Returning a list using select new with LINQ

I can do this: var filial = (from f in base.EntityContext.vw_filial select f).ToList<vw_filial>(); But, I want to do something like this: var filial = (from f in base.EntityContext.vw_filial select new {...
asked by 18.12.2014 / 12:47
2
answers

Suggestion Migration System and modeling of individuals and legal entities in a system with Entity Framework

Well, the question is this. I have a database that has the purpose of making the cash book of a company, basically this bank has a CaixaCorrido table with columns Id , PessoaNome , DataHora , Descricao , Valor...
asked by 09.03.2016 / 15:23