Questions tagged as 'entity-framework'

2
answers

The underlying connection was closed: Unexpected error on receipt

I have a web site that communicates with a WCF. This Wcf communicates with my "DAO" which is a class library where I have the .edmx template for access to the database. I referred my DAO to WCF, and my WCF to my web site. I'm using entity fra...
asked by 23.10.2014 / 01:07
0
answers

Associative entity EF mapping with Fluent API [closed]

I would like to know how to do a mapping without using ICollection , or it might even be using, but I would not want the bank to create a class, just to link the two classes. class Pessoa { public Guid IdPessoa { get; set; } public...
asked by 22.06.2015 / 17:24
2
answers

Using IEnumerable

I saw an example in another post about using IEnumerable var ent = new EntFuncionarios(); IEnumerable<Funcionario> funcionario = ent.Funcionarios; IEnumerable<Funcionario> temp = funcionario.Where(x => x.FuncID == 2).ToL...
asked by 20.11.2014 / 19:45
2
answers

Entity Framework or Stored Procedure

When to use Entity Framework example: var registros = db.Tabela.AsQueryable(); registros = registros.Where(r => (intTipo == 0 || r.IdTipo == intTipo) && r.IdArea == intIdArea && r.DataInicio <= DateTime.Now && (...
asked by 22.01.2015 / 15:22
2
answers

What is the difference between ToListAsync () and ToList ()?

What is the difference between ToListAsync() and ToList() ? As in the example below, what is the difference between one and the other? using Modelo.Classes.Contexto; using System.Data.Entity; using System.Linq; namespace AppCo...
asked by 05.12.2016 / 15:52
3
answers

Call a method automatically via a class class in .NET

I created a partial class for the model users where I implemented some custom functions, such as a function that takes the first and last name assigned and generates a handle , see example below: namespace E_Learning.Mode...
asked by 04.05.2016 / 17:13
3
answers

Entity Framework relationship 1: N

Hello. I have the following classes ... Sales Class: [Table("venda")] public class Vendas { public Vendas() { ItensVendas= new List<ItensVendas>(); } [Key] public int Id { get; set; } public...
asked by 16.11.2017 / 00:18
2
answers

Person registration using multiple viewModels and only one controller

I want to register a person, which I divided into three entities: Person, Contact and Address. And I want it to be just a registration form. My action create in the person controller looks like this: [HttpPost] [ValidateAntiForgeryT...
asked by 20.07.2015 / 20:42
3
answers

Questions about relationship and mapping with Fluent API for EF 6

Whenever I have a class with properties that are of the type of other classes, which at the database level represents a foreign key, will I always need the navigation properties? And see this example: Revenda -> ClienteRevenda ->...
asked by 19.03.2014 / 18:43
3
answers

Update to 2 tables

I can not make an update of the 2 tables. The problem is here. db.Entry(catequizando).State = EntityState.Modified; db.Entry(pessoa).State = EntityState.Modified; db.SaveChanges(); Any solution? Controller : [HttpPost] [Vali...
asked by 28.08.2015 / 18:18