Questions tagged as 'entity-framework'

1
answer

Error when running Updad-Database command

When I run the Update-Database command in the Package Manager Console, I get the following error:    Value can not be null.   Parameter name: entitySet I have only one model in the project for now public class Project { [Key]...
asked by 27.10.2017 / 15:01
2
answers

Working with Seed Method + FK

I'm finding it difficult to work with the Seed method, since I registered the state, and then wanted to register the cities, and then I can not reference the state in the city, what could I do? I believe you have a solution. Seed Meth...
asked by 29.10.2016 / 00:07
2
answers

What's the difference between creating a Context with DbContext and DataContext?

What's the difference between creating a Context with DbContext and DataContext? Is there any performance difference or best practice between one or the other? See the examples below; namespace _DBContext.DBase.Banco { public class dbCo...
asked by 03.11.2016 / 17:32
1
answer

Name of columns in web service return xml

This line gives me this error: if (db.T_TarefaParceiro.Max(p => p.IDTarefaParceiro) != null) The error The cast to value type 'System.Int32' failed because the materialized value is null. Either the result type's generic parameter or t...
asked by 27.05.2014 / 02:08
1
answer

When mapping class to viewModel, some data is lost

I have a query that returns a client and its phone, but when mapping the class to the viewModel , I lose the phone data: query: public Cliente ObterClientePorId(Guid ClienteId) { var consulta = Contexto.Cliente.Join(Conte...
asked by 27.08.2015 / 20:18
1
answer

Error updating entries in the Entity Framework

I have the following code for mapping my application, but when I try to make a insert it gives the following error.    An error occurred while updating the entries. See the inner exception for details I've already had this error I...
asked by 25.10.2014 / 04:03
1
answer

I need help to turn this SQL into a LINQ

I have the following SQL: select conferencia.tb_conferencia.con_codigo, con_pedido, count(coi_codigo) as countItens, count(distinct cic_conferencia_item) as countItensConferidos from conferencia.tb_conferencia left...
asked by 23.08.2017 / 14:58
1
answer

Fill date and time in View mvc 5 razor

I have a registration form where I have a record date field that I currently fill in my save method, except that my server is hosted in another country where the field is being filled from the location of the hosting, quite different from where...
asked by 12.12.2018 / 19:27
1
answer

Auto Relationship with Entity Framework 2.2

How do I make an Auto Relationship with EF Core 2.2? I found a link that teaches how to do with EF, but in EF it does not have the WithOptional method. public class Menu { public int Id { get; set; } public string Title { get; set;...
asked by 12.12.2018 / 17:44
1
answer

Doubt in a lambda expression returning "true"

When I do this: List<Tipo1> tipo = await context.MeuMetodo.Find(x => true).ToListAsync(); What am I saying here: (x => true) ?     
asked by 27.06.2018 / 15:12