Questions tagged as 'entity-framework'

1
answer

How to map the Relationship to the base class in Table per Type (TPT)

I have the following scenario: Eachentityinthishierarchyhasitstable.But,nowIneedtoregisteraPersonwithaCitywhereshelives.HowdoImaptorecordaCityinaPerson?PersonClasspublicabstractclassPessoa{publicintId{get;set;}publicCidadeCidade{get;set;}}Cl...
asked by 20.01.2016 / 01:10
0
answers

Send a list to a web api using $ http.put of AngularJS

I'm having trouble getting a list using the $ http.put method of angularjs, I can send an object normally, but a list is not following, does anyone have any code examples so I can clear this question or pass a link of some material about, from n...
asked by 20.07.2015 / 19:01
2
answers

ToList () returning read-only

Follow the code below: using (var db = new Entities()) { var result = db .Tabela1 .Select(x => new { x.Coluna1, x.Coluna2 }) .ToList(); foreach (var item in result)...
asked by 30.10.2017 / 22:26
1
answer

How to resolve the error: The best overloaded method match for

Following the templates this question when I have the following command: "The best overloaded method match for some invalid arguments" Controller public ActionResult Novo() { ViewBag.Nacionalidade = new Selec...
asked by 17.11.2015 / 17:19
2
answers

Button / link within a view redirecting to another view

I have the following address of a view : http://localhost/Configuracao/Details/1 Where to create a button / link that redirects to another address of another view as follows: <a href="@Url.Action("~/Views/Ativos/Index", Mo...
asked by 20.02.2015 / 19:20
1
answer

Implementing the concept of database inheritance

Why is not the PessoaJuridicaId attribute generated? This is the base class Pessoa : public class Pessoa { public Pessoa() { DataCadastro = DateTime.Now; } public int PessoaId { get; set; } public Da...
asked by 01.08.2017 / 14:04
2
answers

Random Query List Linq to Entity C # [duplicate]

I would like to get a list of 3 objects within a query Link. var listaPessoas = from i in this.Context.CreateObjectSet<listaPessoas>() select i; ... listaPessoas = listaPessoas .Where(x => x.Nome.Contains(filtro.Nome); ......
asked by 31.08.2017 / 15:28
2
answers

Context Dispose should be used in ASP.NET MVC?

In Web Forms whenever I mounted some kind of CRUD , I used using to make an implen in>. public List<Produtos> Lista () { using (var ctx = new DbContext()) { return ctx. Produtos.ToList(); } } In ASP.NET MVC th...
asked by 24.03.2016 / 19:47
3
answers

Bring a Max (Date) with LINQ

I have this Linq : var resultado = ( from pdv in db.T_PDV from tarefa in db.T_TarefaParceiro.Where(trf => trf.CNPJ == pdv.CNPJ).DefaultIfEmpty() from parceiro in db.T_OsParceiro.Where(prf => prf.IDTarefaParceiro == tarefa...
asked by 13.06.2014 / 22:33
1
answer

Error Entity Framework | not handled in user code

Hello, I need help in the following scenario. I have a class, where the field is int64 in the backend and in SQL Server the field is bigint. ObjClasse.VariavelInteira = numInt; db.SaveChanges(); When saving, the error it presents is:...
asked by 10.01.2017 / 19:41