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
votes0
answers101
viewsHow to create composite key and ensure the same property in 2 model
I have 3 model public class UnidadeNegocio { public int Id { get; set; } public string Nome { get; set; } } public class Cliente { public int Id { get; set; } public int UnidadeNegocioId { get; set;…
-
0
votes0
answers133
viewserror while doing enable-Migrations in visual studio on a mvc project
I’m trying to connect my project to my local bank. and my connect string is below. <add name="DefaultConnection" connectionString="Data Source=LAPTOP-QEGG9P00;Initial…
-
0
votes1
answer81
viewsEntityFramework DatabaseGenerated
I have a property in my model where automatically generates the Id when it is inserted in Db, but I have a specific case where I need to put the Id manually, there is some way to prevent the EF from…
-
0
votes1
answer59
viewsDependencies with Entityframework C#
My question is how to use the state-class include for parents, because the city-class has no connection with parents. How to perform this sql by loading the dependencies? private void…
-
0
votes1
answer1271
viewsError CS0012 The type 'Client' is defined in an Assembly that is not referenced
Handling class with RU: ContextEF Contexto = new ContextEF(); public List<Cliente> Listar() { //var query = from c in Contexto.Cliente // select c; return Contexto.Cliente.ToList() ; } Onclick…
-
0
votes0
answers285
viewsCall Controller Search Action
I have an action in my controller that calls a service that does a search using stored procedure and returns a list to me. I made the form in the View to call this Action, only it’s not calling…
-
0
votes1
answer122
viewsError trying to save information to the database via Entity Framework
My project has the following classes: public class Manifestacao { public long Id { get; set; } public string NumeroChamado { get; set; } public virtual Cliente Cliente { get; set; } public virtual…
-
0
votes0
answers38
viewsSlowness in Entity C# when saving image
I’m slowing down the system I created in c# using Entity Framework. At the moment when I am saving a record of an attachment, I am compressing the file. Before I check if it is . jpg or . pdf (only…
-
0
votes0
answers118
viewsRelationship 1:1 with abstract class in EF
All right, guys? I have the following problem: I have two classes Person and Property who may have an address (Address), but the class Person may have 0:N Address and the Property 0:1. Knowing that…
-
0
votes1
answer76
viewsUnable to Retrieve Metadata for - Error creating Controller
I created a web project with MVC and Entity framework 4.5, and MYSQL database. added the dlls Mysql.Data Mysql.Data.Entity and Mysql.web I made all settings as per images below I followed the step…
-
0
votes0
answers94
viewsSend form with file using ajax web api Entity framework
I’m trying to send a file along with the form to the database, but when I send it returns me error 400 bad request, I don’t understand why. Curriculoscontroller // POST: api/Curriculos…
-
0
votes1
answer57
viewsWhy does the one-to-many relationship in the Entity Framework by default not work?
[Table(name: "cliente", Schema = "estudo")] public class Cliente : Base { [Key, Column("COD_CLIENTE")] [Required] public override Int64 Id { get; set; } [Column("CLI_NOME")] [Required] public…
-
0
votes1
answer649
viewsTo change the column name of a table using the Add-Migration Code First Asp.Net MVC command
I have a table already created and I want to change the column name without them being deleted, because it already has a lot of information. I did the procedure of renaming the property Street to…
-
0
votes0
answers136
viewsdbContext static with Entity Framework: Compensates or not?
Guys, I use Entity Framework and Code First to manage my data access, and I’m thinking of working with a single instance, static and global of my Databasecontext. But I have two questions: What…
-
0
votes1
answer218
viewsDeclare Entity Framework Relationship one for many
I have two classes: Person public class Pessoa { public int Codigo { get; set; } public string Nome { get; set; } .... public virtual ICollection<Endereco> Endereco { get; set; } } Address…
-
0
votes0
answers151
viewsASP.MVC ENTITY Code First (odd problem)
I do not know if I am doing something wrong (probably yes). But EF is persisting the data in a BD and in a table that it creates alone. I’ve repeated this step-by-step twice and the result is the…
-
0
votes0
answers103
viewsAdapt Idbset EF6 to EF Core
I’m migrating from Entityframework 6x to Entityframework core, but I’m picking up a bit to implement an Idbset interface that doesn’t exist in EF Core. Instead of her, I need to use something like…
entity-frameworkasked 7 years ago Master JR 1,853 -
0
votes1
answer211
viewsHelp to write to USERS and Aspnetusers at once
Help please. I’ve spent my whole day redoing various parts of the system, trying a lot of different solutions but ended up without ideas. I have a solution with several applications. One of these…
-
0
votes0
answers322
viewsError: The Entity types 'Customrole' and 'Aspnetroles' cannot share table 'Aspnetroles'
People created the whole structure Identity to work with INT instead of GUID. Using Database First and included in the database, with a create script, the modified Identity tables (I only changed…
-
0
votes0
answers95
viewsError saving data with EF
I am assembling my unit tests and trying to save the data in a table using the Entity Framework, but at the time I run it returns an error. Validation failed for one or more entities. See…
-
0
votes0
answers94
viewsEntity Framework (Database first) - Include Dataannotations
I saw in an MS link that it is possible to create a partial class and a Metadata class to include Dataannotations in properties created by the Entity Framework (database first). Well, I did as it is…
-
0
votes0
answers380
viewsThere has been a violation of the referential integrity restriction
I am getting this error every time I try to update an object in my SQL database via Entityframework, the error is as follows: A reference integrity constraint violation occurred: Property values…
-
0
votes1
answer218
viewsTwo Foreign key in the same EF column
I have a question, I am programming with . NET MVC using the Entity Framework. At the moment I have: class Produto { public int ProdutoId { get; set; } public string Nome { get; set; } public string…
-
0
votes0
answers53
viewsWhich is faster? Looking for data in the bank or reading a cookie?
Guys, in your opinion, what would be better in this situation? I’m working on an Asp MVC and Entity Framework website. I have a table of federative units where I have (simplifying) 3 columns Id,…
-
0
votes1
answer105
viewsHow to avoid having to refer to the RU?
Hello, everyone. I basically have a data access layer with EF6 and a presentation layer (Asp.Net Webapi). I am unable to make it work without the presentation layer referring to EF. Does anyone know…
-
0
votes1
answer61
viewsFluent api - Map table to another table with the same key
I need to know how to map in the Fluent API the following item public class ImportacaoHeader { public string IdImportacao { get; set; } public DateTime dataInicio { get; set; } } public class…
-
0
votes0
answers53
viewsEF - A Member of the type, 'X', does not have a corresponding column in the data Reader with the same name
Good, I am using Entityframework to pass the result of this query: SELECT a.* FROM [Logística$Sales Invoice Header] AS a INNER JOIN [Logística$Sales Invoice Line] AS b ON a.No_ = b.[Document No_]…
-
0
votes1
answer950
viewsForeign key Entity framework Asp.net mvc
I have My Repair and Repair Table and I’m getting the following msg when I try to update my Migration: "The introduction of the FOREIGN KEY restriction 'Fk_dbo.Fixeddbo.Pecas_pecasid' in the 'Fix…
-
0
votes1
answer911
viewsReturn data from 2 Entity framework tables
I have the following table: Moving -moving -Clienteid -Productoid When I select a particular customer I want to list all drives in which they are along with the product. what I would call it inside…
-
0
votes1
answer198
viewsRecover data from View Asp.net
I have following problem, when I place an order in the quantity field when I place a certain number I have to arrive if I have in stock in the bank, and if I have to reduce the quantity in the…
-
0
votes1
answer215
viewsEntity Framework Asp.net mvc data comparison
I need to receive the value and quantity in stock of a particular product according to your Id.By debug the product id is arriving correctly, but when I am going to assign the values to the table…
-
0
votes2
answers31
viewsCompare shorter term between Asp.net columns
Making order system, I have several warehouses, let’s assume I have to compare 2 warehouses that have shorter delivery time using entityframework,how would I do that? I’m trying to do more it just…
-
0
votes0
answers235
viewsSystem.Data.Sqlclient.Sqlexception Conversion failed when Converting date and/or time from Character string
Viva Pessoal, I’m new to the world. NET, C#, Entityframework (Microsoft world). I am working on a project with the mentioned technologies, initially I was programming on a VM (with Windows) because…
-
0
votes2
answers84
viewsWays of connection in ASP . NET
I’m a beginner in ASP and C#. I have doubts and this is the real reason to ask here. Before you have to read the politics of questions understand that I am a beginner and I really need help. I have…
-
0
votes1
answer43
viewsHow to catch daughter entities from a data constraint?
Well my problem is this, I need to bring a bank entity and it contains several lists that should bring your data following a rule, the field data_exclusao must be void. All entities have the field…
-
0
votes1
answer140
viewsProblem creating foreign key in Entity
I’m trying to create a Primary key composed, until everything well. With this I need to make a Foreign key composed. I have more or less the following scenario (it is a hypothetical scenario but…
-
0
votes2
answers55
viewsProblem saving data to database
I created a simple application, but when clicking on the action button responsible for saving the data, the program stops working. Follow picture: Save button action:- private void…
-
0
votes2
answers184
viewsEF - Navigating through Icollection
I have the following class in an application for C# practice purposes with Entityframework: public class Livro { public Livro() { Autor = new HashSet<Autor>(); } public int Id { get; set; }…
-
0
votes1
answer81
viewsVery slow query to export in excel
I created a method to export a few columns to xls and it is very slow the process, it takes about one minute to do the whole process. public void Download(string datainicio, string datafinal, int?…
-
0
votes2
answers159
viewsHow to use the Where clause with Inno?
I need to make a Join between the person and people tables so that the core Entity Framework brings a corresponding record. Let me be clearer: In the personal tableentity, I sort my register of…
-
0
votes0
answers147
viewsProblems returning a Iqueryable<> list to convert it with Automapper
I have a function that returns me a list of people with their personal/legal relationships. I own a Personal Viewmodel that is already mapped in the Autommapper layer... When I call the Getjoinall()…
-
0
votes1
answer37
viewsSelect with filter in Entity being generated duplicate
I have a droplist that lists the states, that when a state is selected it filters the cities related to that state. It turns out that when I select cities comes duplicate. For example, I have states…
-
0
votes1
answer123
viewsError Adding Controller with views using Entity Framework in Asp.NET
When trying to add the following error appears: Model: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MVCEntity.Models { public class Usuario { public…
-
0
votes0
answers26
viewsAutomatically generate procedures with table-type field in Entity-framework
I am trying to generate an existing database for Entity-framework 5,I managed to generate without problems,with all relationships in this database I have procedures that receives as parameter a…
-
0
votes0
answers41
viewsAutofac: No Scope with a Tag matching Autofacwebrequest
I would like your help to solve the following problem: Imagine that I have a Servicefactory class responsible for creating services (such as srvFact.Create<MyService>()), a Repositoryfactory…
-
0
votes1
answer146
viewsEntityframework problem - An Entity Object cannot be referenced by Multiple instances of Ientitychangetracker
I have a project where a dropdownlist is loaded with the following instructions: var lista = entities.prato.OrderBy(x => x.nome).ToList(); combo.DataTextField = "nome"; combo.DataValueField =…
-
0
votes1
answer552
viewsEF Core 2 + Relationships between tables
Hello, I am starting a project, and I started using for the first time the new EF Core, for the sake of performance, but still have some things that I did not find on the internet that I would like…
-
0
votes1
answer161
viewsError connecting to database using Entity Framework
I am creating a WPF application, and decided to use the Entityframework to perform operations in my bank. I created a data model from an existing database in my Mysql Workbench, and the process was…
-
0
votes2
answers173
viewsC# - Filter Include - Context
In the method below, I return some records of my entity Consultintramexrules, where it has relation with the . INCLUDE ("Emails and Parameters"). Aware that EF does not allow filtering in . INCLUDE,…
-
0
votes0
answers45
viewsHow to turn my query into a Linq query?
I need to mount this query in Entity select ped.Id, prot.Prot_numero as Protocolo, ori.Descricao as Sistema, cla.Id as Equipe, cla.Descricao as Finalidade, forn.Nome as Fornecedor from Pedidos ped…