Questions tagged as 'entity-framework'

1
answer

Change only edited columns

In an application I'm developing, when trying to perform the update only on the fields that have been changed the Entity Framework is also changing the fields that do not need. Repository code: public void Update(T entity) { m_Context.En...
asked by 22.06.2018 / 00:49
2
answers

transform sql with subquery into query on entity

I'm needing and am having trouble getting this sql with subquery and doing the same thing in c # entity. SELECT Id,Nome, (SELECT Count(Id) FROM Pedidos WHERE Pedidos.ColaboradorId = Colaborador.Id) AS NumeroPedidos FROM Colabora...
asked by 18.06.2018 / 14:27
1
answer

Select with filter on entity being generated duplicate

I have a droplist that lists the states, which when a state is selected it filters the cities for that state. It turns out that when I select cities it comes duplicated. For example, I have states in select that are São Paulo, Minas Gerais...
asked by 11.04.2018 / 18:17
2
answers

EF - Navigate through ICollection

I have the following class in a C # practice application with EntityFramework: public class Livro { public Livro() { Autor = new HashSet<Autor>(); } public int Id { get; set; } public string Titul...
asked by 15.03.2018 / 01:53
1
answer

Does not contain a definition for 'Include' and the best extension method overload 'QueryableExtensions.Include (IQueryable, string)

Why does not my code recognize the .Include ("Category") method in my ConsoleApp? Where am I going wrong? Severity Code Description Project File Line Suppression State QueryableExtensions.Include (IQueryable, string) 'requires a receiver of typ...
asked by 31.03.2018 / 20:34
1
answer

Use existing database

I have a database (SQL-Server); if I connect to it, will I still have to create EF classes and use a migration ?     
asked by 16.02.2018 / 15:01
1
answer

Recover data from asp.net View

I have the following problem, when I place an order in the quantity field when I put a certain number I have to get it if it is in stock in the bank, and if I have to decrease the quantity in the bank, I do not know how to pass the value of the...
asked by 16.02.2018 / 20:26
1
answer

Foreign key entity framework asp.net mvc

I have My Table Repair and RepairDetails and I am getting the following msg when I try to update my migration: "The introduction of the FOREIGN KEY constraint 'FK_dbo.ConsertDetalhes_dbo.Pecas_PecasId' in the 'FixDetails' table can cause cycles...
asked by 02.02.2018 / 16:38
1
answer

Duvida Interface asp.net mvc [closed]

Good evening, I have a doubt, I chose to work with generic interface and my doubt is: Does every entity need to have an interface inheriting from the generic interface? Ex: public interface IPessoaRepositorio : IRepositorio<Pessoa> Or...
asked by 29.01.2018 / 01:19
1
answer

Ado.Net and Entity in the same project

I took a test to do and it is mandatory to use Ado.Net, but it would be a differential use of Entity. I'm kind of confused about that. Ado.Net and Entity give dancing?     
asked by 06.12.2017 / 18:51