Questions tagged as 'entity-framework'

4
answers

Why use the using block in ASP.NET MVC?

Does the using {} block work in the same way in both web and desktop applications in the sense that when we use it in controller ? It is a good practice to declare it in actions that there is contact with database Follow exam...
asked by 21.10.2015 / 18:09
3
answers

How to change the structure of a LINQ query at runtime?

I have the following example of a program that implements the EF (Entity Framework). The bank and application structure is defined as follows: Table Pessoa : Primary key field: id_pessoa Field name: nome Field age:...
asked by 27.05.2016 / 01:17
2
answers

How to filter a list asynchronously using LINQ?

Code sample without using async: var products = db.Products.Where(_ => _.UserId == currentUserId); How do I make this query asynchronous taking into account that Where of Linq does not support the use of await ?     
asked by 16.09.2014 / 18:05
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
4
answers

Generate sequential IDs without losing the sequence

By Identity do not want to, because it breaks the sequence if something happens. Max() + 1 , I find it very vulnerable and slow when I have many records. So I ask, is there a way that someone knows, that I can generate sequential n...
asked by 05.06.2014 / 20:33
2
answers

Faster way to save multiple entities with Entityframework

I have a performance problem in one method, in addition to causing full use of CPU of the server this method takes a long time to execute. internal async void NotificacaoIosTodos(string titulo, int posicao, int unidadeId) {...
asked by 09.08.2017 / 00:53
4
answers

Which DBMS do I use so it can be installed on the client computer to run a C # application?

I'm developing a small C # system that will eventually be deployed to client computers by accessing a local database. Initially I was going to use SQL Server, but I would have to install it next to the system, and it gets kinda heavy for just...
asked by 11.07.2017 / 11:15
2
answers

Entity Framework WITH (NOLOCK)

We can use the NOLOCK feature in SELECT , thus avoiding locks with INSERT SELECT COUNT(Descricao) FROM Produtos WITH (NOLOCK) Would there be any way to use WITH(NOLOCK) in the Entity Framework?     
asked by 22.02.2017 / 17:08
3
answers

Map Many to Many in the Entity Framework

I have a problem mapping with the Entity Framework. I have two models, "project" and "company", where in the "company" there can be several "projects". public class Projeto { [Key] public int Id { get; set; } public string Nom...
asked by 18.04.2017 / 14:28
3
answers

Update generating duplicate key error

I have a web application in .net 4.5.1 with MVC and entity framework. The error occurs in a basic CRUD. I retrieve the object that will be the model sent to the view with the following code: Professor professor = db.Pessoa .I...
asked by 03.02.2014 / 22:15