Most voted "entity-framework" questions
ADO.NET Entity Framework is a set of tools for object-relational mapping or Object-Relational Mapping (ORM) for the . NET Framework by Microsoft, Since version 3.5 SP1.
Learn more…1,214 questions
Sort by count of
-
0
votes1
answer98
viewsSave multiple data from text boxes with equal names
In my project I have a rule that is to save several fields with the same name at once. Today, the registration works, but only one field, and that’s not what I want.. I need that when clicking to…
-
0
votes1
answer259
viewsCreation of Foreignkey
Well, in my project I decided to use some Foreign Keys. And after getting this error : {"The INSERT statement conflicted with the FOREIGN KEY Constraint "Fk_dbo.Setors_dbo.Areas_setorareas ". The…
-
0
votes1
answer739
viewsEntity Framework List
I am created to action of Edit to edit my data models. What happens is I use Viewmodel to "join" several models in a. Okay, I can get the data from models who are not List<>, that is, the…
-
0
votes0
answers49
viewsError when trying to insert data from a mixed table
I’m starting an MVC project and I’m having a problem that I can’t fix. [Table("InfoGeralEmpresa")] public class InfoGeralEmpresa { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage",…
-
0
votes1
answer274
viewsEntity Framework Code First. How to generate two banks from two projects, with the second project using classes from the first
Personal talk! I have a question regarding Entity Framework 6. I have two projects A and B, A being a shared core. It has some classes as Parents, State, City, Address etc. In Project B, I have some…
-
0
votes0
answers106
viewsEntity Framework error mapping classes from existing database
I have an SQL Server database and had the mapping classes automatically generated from the existing database. However, when I run the application, it gives the following error: (404,10) : error…
-
0
votes1
answer88
viewsPublishing system with Entity Framework 6
There is an executable installer for Entity Framework 6 for servers. I posted the system to a Windows server 2008, and it’s not working. Is returning the following error: Schema specified is not…
-
0
votes1
answer272
viewsDynamic filters using lambda
I have a table Errosproducao_records linked to another table called Errosproducao_tipos. I need to perform dynamic filters in the table Errors_records using lambda expressions. if I perform the…
-
0
votes1
answer60
viewsList reservations by Administrator
I am trying to list my bookings by different administrators. However, as I did, it lists all bookings. That’s the method I’m using: public ActionResult Index() { Administrador administrador =…
-
0
votes0
answers71
viewsHow popular is Reportdatasource() object in a webform.aspx?
As an example below follows the example of the Entity, Interface, Repositorio and the Controller of the MVC system. In sequence the code of a formulário webform.aspx what use to display the Pedido…
-
0
votes1
answer137
views.Include() does not carry child class - Lazyloading C#
I was using the DDD Model with Repositories and with 3 layers of data, (Serviço,Repositorio and Dominio), with the help of some users here I decided to change the project and now I ended up removing…
-
0
votes1
answer88
viewsModify generic method to merge information into classes
I’m a first-time sailor with the Entityframework and I’m working with a class USUARIO who inherits from PESSOA. There are other classes like PESSOATIPO, PESSOAFISICA, PESSOAJURIDICA, etc., the…
-
0
votes1
answer1256
viewsHow to format`Datetime? ` in dd/mm/yyyy format using Linq?
I have the query below, but while trying to format the field Data_nascimento and Data_exclusao with the .ToString("dd/MM/yyyy") returns me to an error at runtime. The 'System.String…
-
0
votes1
answer26
viewsError accessing array indices inside a LINQ expression
I am doing a query to search all weather with a certain date, but when executing occurs the following error: An exception of type 'System.NotSupportedException' occurred in…
-
0
votes1
answer1684
viewsMaking Codefirst Error in Enityframework
That’s the mistake that’s happening: An unhandled Exception of type 'System.Typeinitializationexception' occurred in Entityframework.dll Additional information: O…
-
0
votes1
answer415
viewsHow to return only the ref. data to the logged in user
I have a table that returns the following data from an SQL Server database: INITIAL KM; KM Final; Liters; R-value$. However I would like to return only the values ref. to the logged in user. In the…
-
0
votes0
answers408
viewsTwo Dropdowlist ASP.NET MVC 5 filter
I would like to make a filter with two DropDownList. In the first filter are filtered the registered Units and in the second the Functions registered in that unit, with their respective Employees.…
-
0
votes1
answer142
viewsC# Entity Dbset with DDD?
I have an app C# MVC with DDD and in the repository I’m making the call like this: return DbSet.Include(i => i.Cliente).FirstOrDefault(a => a.ProcessoId == processoId); DbSet-> is in the…
-
0
votes1
answer182
viewsConsultation in Relationship Many-to-Many with LINQ to Entities
I created a database that has two tables called Teachers and Courses. A teacher can teach many courses and a course can have many teachers. I created the table Undergraduates to relate both. When…
-
0
votes1
answer71
viewsWhat implementation would I use to initialize the data in the database using 1:N relationship?
My intention is to initialize a SubCategoria, but she needs a Categoria first (1:N). I wanted to know which implementation I would use to make this relationship work to boot into the database? I’m…
-
0
votes1
answer1846
viewsHow to use the Contains method in a search using the Entityframework
I’m trying to make the following consultation sql, using the Entityframework: select * from pedidos where pedidoID not in (select pedidoID from agendamentos); I conducted some research and…
-
0
votes1
answer728
viewsCode first Migrations does not work
I did it in a separate layer called Data public class Context : DbContext { public Context() : base("EscolaContext") { } public DbSet<Escola> Escolas { get; set; } public DbSet<Turma>…
-
0
votes2
answers428
viewsThe type must be a Reference type in order to use it as Parameter 'Tentity' in the Generic type or method 'Dbset<Tentity>'
I am trying to set up an Enum in ENTITY FRAMEWORK. But I am not succeeding. My Context is like this: public class MoradaWebContext : DbContext { public DbSet<MeuEnum> Status { get; set; } }…
-
0
votes1
answer88
viewsConnection problems between the Entity Framework and the Database?
While running my application I am encountering the following error when loading the data through the Entity Framework. When it is executed I observe that the following is called connection string:…
-
0
votes2
answers598
viewsEntity Framework - When editing, "db. Entry(Category) fails. State = Entitystate.Modified;"
I own a "Category" Entity, which contains id, name, created and updated. I am using Code First. This is my model: public class Category { public int CategoryId { get; set; } public string Name {…
-
0
votes0
answers72
viewsValue shown in production other than development
I have an application in ASP.NET MVC with the Entity Framework with an Oracle database, and the same one showing some wrong data, and this happens only in production, in Debug(locally) the data is…
-
0
votes0
answers28
viewsASP.NET MVC project using Entityframework
Guys, a very beginner question, I did an ASP.NET MVC project using the Entityframework, I did using the standard Unitofwork: public class UnitOfWorks : IDisposable { // Context private AgendaContext…
-
0
votes1
answer283
viewsValidate Business Rule
I’m using this sample tutorial Data repository to create a layered crud with Entity Framework with Code First. My question would be how to validate a business rule where a user with already existing…
-
0
votes1
answer287
viewsError saving Entity framework
I have a very basic problem, but I must be short of coffee to understand what is happening. I have such an entity: public class Client : BaseEntity<Client> { [Required] public string…
-
0
votes0
answers102
viewsParameter ignored in EF 5.0 Connection Timeout
My application is showing an error of TimeOut when I perform operations that require more processing time. I’m using the EntityFramework 5.0 and set up the Connection Timeout=480 to do tests, but it…
-
0
votes1
answer84
viewsUpdating the SQL database in the MVC project
I made a column change in my SQL BD in my ASP.NET MVC project. I changed a column of Cliente_RG (INT) for Cliente_Bairro (String). In SQL the change was OK. In the project, in all tables (think) the…
-
0
votes1
answer38
viewsError while restoring external database from Asp.net mvc application
I’m trying to restore a bank SQL that I created on a provider that does not have the option Webdeploy. And my goal is to boot a database using ASP.NET MVC with EntityFramework. Well, when you put…
-
0
votes1
answer27
viewsForeingkey is not updated
I am unable to change a foreingkey field in the database. In my case, the objects (Typoendereco = 3 and Address = 2) already exist. Follows the model (simple): public class Endereco { public int Id…
entity-frameworkasked 7 years, 6 months ago Leandro Duarte 61 -
0
votes1
answer39
viewsEntity Framework - Fluent API - Error
I’m following this tutorial. Creating the class below gave an error: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using…
entity-frameworkasked 7 years, 5 months ago HeyJoe 819 -
0
votes1
answer392
viewsClass mapping with Fluentapi and Entityframework C#
Table Parents, State, City; A country can have several states and a state can have only one country; State->Parents : 1:N A city can have only one state and one state can have several cities.…
-
0
votes1
answer36
viewsMigrations Entityframework C#
Error while performing Migrations. The ADO.NET Provider with invariant name 'Sqlclient' is either not Registered in the machine or application config file, or could not be Loaded. See the Inner…
-
0
votes1
answer93
viewsSort by Reflection with Getproperty
I have a generic class with a method that needs to sort a generic object. However, give error saying that does not recognize the Reflection Getproperty method, because lambda can not translate. How…
c# asp.net-mvc entity-framework classification reflectionasked 7 years, 5 months ago LeoFelipe 1,455 -
0
votes1
answer221
viewsConsult by Date
Well I am using the EF with the following code to query it brings the query by name and type but by date not, since the time is not in my filter with the time 00:00:00 it brings correctly the time…
-
0
votes1
answer184
viewsEF Core Complex Object Insertion with Webapi
I am developing a Webapi (.NET) application with Entityframework Core. I implemented the following entities: Pais.Cs public class Pais { [Key] public int Id { get; set; } [MaxLength(100), Required]…
-
0
votes4
answers488
viewsHow to treat this Nullreferenceexception
I don’t understand why I’m getting one NullReferenceException, in that beautiful code: pessoaJuridica.InscricaoEstadual = viewmodel.PessoaJuridica.InscricaoEstadual; What I’m doing wrong? Follows…
-
0
votes1
answer97
viewsError: Could not parse type 'xxx[]' because it does not have any known mapping to the value layer
In the controller I have my session built. public const string ListaPermissao_SessionName = "ListaPermissao"; private List<ListaPermissao> ListaPermissaoEnvio { get { if…
-
0
votes1
answer496
viewsCheck for list records in the Entity framework
I have the following code: var ret = Monitoramento.List .Include(p => p.CD) .ThenInclude(p => p.CargaEntrega) .ThenInclude(p => p.CargaEntrega.Motorista) .ThenInclude(p =>…
-
0
votes1
answer104
viewsError when using GROUP via LINQ
I’m trying to perform the query below: var query = from s in db.Crm_Analise where s.cliente_CRM == cod_cli group s by s.TAG into g select new { TAG = g.Key, ATUALIZAÇÃO = g.Max(t =>…
-
0
votes1
answer488
viewsDelete a foreach and replace the result in a lambda expression in a method
It’s pretty simple stuff. I have a method that takes a name inside a database and compares it with the parameter passed in the method and be equal, return it in the method, otherwise return a…
-
0
votes3
answers58
viewsNullreferenceexception error in Join
I created a Join in LINQ to create a List: (from p in listaProcedimento join pd in oListaprocedimentodetalhe on p.codigo equals pd.codigoProcedimento into pd1 from pd2 in pd1.DefaultIfEmpty() select…
-
0
votes0
answers182
viewsInsert given with Entity and no Identity field
I have this method to insert in the bank: public virtual void Inserir(T item) { contexto.Set<T>().Add(item); contexto.SaveChanges(); } And I have it in my Product entity, for example: .......…
-
0
votes1
answer922
viewsError: Validation failed for one or more entities. See 'Entityvalidationerrors' Property for more Details
The following error occurs when I try to insert data into the system: Validation failed for one or more entities. See 'Entityvalidationerrors' Property for more Details. It turns out that the…
-
0
votes1
answer54
viewsError loading database information to a datagridview via Entity Framework
My project has four classes: public class Manifestacao { public long Id { get; set; } public string NumeroChamado { get; set; } public string DataHoraReg { get; set; } public Cliente Cliente { get;…
-
0
votes1
answer67
viewsTotable method is not recognized
Contextualization I am starting in ASP.Net CORE and, to consolidate the knowledge, I am trying to make a small project already using this framework. However, I am having trouble mapping my domain…
-
0
votes1
answer23
viewsError saving record without choosing category in dropdownlist
Guys I’m having a problem when clicking save with some data filled ends up giving error how could solve. By clicking save from this error This is the controller to create public ActionResult…