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
-
2
votes2
answers800
viewsSlow SQL LINQ C# Entity Framework problems
I am using Entity Framework, I have a list of objects (data taken from the database) with data from Clients, public virtual DbSet<clientes> clientes {get;set;} public…
-
2
votes3
answers3848
viewsI can’t connect localDB with visual studio
I’m trying to use the Entity framework in Visual Studio, but when I try to run the program generates the error: System.Data.SqlClient.SqlException was unhandled Class=20 ErrorCode=-2146232060…
-
2
votes1
answer128
viewsAnalogy between POO and database
I’ve been reading about the Entity Framework, that it has some features of transforming classes into tables and objects into lines. I found it super interesting! To what extent is this analogy…
-
2
votes0
answers56
viewsAdd comment to the one column with Entity core framework Fluent api
How do I add a comment to a column. In sql I do so: ALTER TABLE Tabela MODIFY COLUMN 'nome' varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Teste' AFTER `nome`; How to do in…
-
2
votes2
answers104
viewsError saving a Many-To-Many relation
Following the models that of that question, I am having problems trying to save the data (keys of each of the records) in the table created to make the data relationship. Follows the post method I…
-
2
votes2
answers293
viewsUsing Linq to sql, how do I get the generated sql query?
Hello. If I have an example: var agendamento = _repository.First(a => a.iid == id && a.locIid == _usuario.LocalidadeContextoId && a.activeVersion == 0, "", true); I can see the…
-
2
votes1
answer162
viewsWebmethod with Data Model
Good morning, I would like to receive a data model in a method of my webservice, what is the correct procedure for me to get ? I’m trying the code below but it’s not working. namespace UI.Web {…
c# entity-framework web-service entity-framework-6asked 8 years, 11 months ago Daniel Gregatto 1,054 -
2
votes1
answer446
viewsSeparator of thousands
How could you put thousands apart into one textBoxFor()? Example: Value entered in View 1,321 ( The point is for visual ease only) controller would receive the 1321 value to insert into the base. My…
-
2
votes1
answer118
viewsRename column with Entity framework
I would like to know how I can solve the following problem. I have the class below: namespace CustomizandoCodeFirstMigrations.Migrations { using System; using System.Data.Entity.Migrations; public…
-
2
votes1
answer1246
viewsUpdate multiple records with Entityframework
Assuming I have the following appointment: UPDATE tb_foo SET idoso = 1 WHERE idade > 65 To carry out this same process in Lilli, I have IEnumerable<Foo> foos = contexto.Foos.Where(e =>…
-
2
votes1
answer194
viewsHow to insert entity with ID into Entity Framework
How to insert an entity with ID in Entity Framework 6.0? That is, insert with ID because the table does not generate it. For example: var last = _contexto.Area.AsEnumerable().LastOrDefault();…
-
2
votes1
answer593
viewsC# + Entity + Mysql = The underlying Provider failed on Open
I have a problem when I host my system on the Ocaweb. My system is done in C# Asp.net MVC3 with EF and Mysql. This problem occurs only in Ocaweb, I already checked the connectionstring and this all…
-
2
votes0
answers712
viewsASP.NET MVC - Alternative to the DDD
I will start building an application let’s say, initially small, about 5 Cruds and only 1 Core (this yes a little more complex in terms of business), but the goal is that it grows over time, using .…
c# asp.net-mvc entity-framework pattern-design software-architectureasked 8 years, 10 months ago Guilherme Ferreira 369 -
2
votes1
answer108
viewsHow to map the Relationship to the base class in Table per Type (TPT)
I have the following scenario: Each entity in this hierarchy has its table. But, now I need to register a Person with a City where she lives. How to map so I can record a City in a Person? Classe…
entity-frameworkasked 8 years, 10 months ago Renan 4,628 -
2
votes1
answer196
viewsObjectdisposedexception
I have the following code snippet: var nivel = 1; List<meuObjeto> meusObjetos = new List<meuObjeto>(); using(var objectContext = ((IObjectContextAdapter)db).ObjectContext) { var cmd =…
-
2
votes1
answer1368
viewsUse of search/search filters with Entity framework
I am creating a grid with book data and I am adding some filters, the problem is time to create the filters of a table that has a link with books, I can’t navigate(Obs.:in the view I can navigate in…
-
2
votes1
answer25
viewsInsert password entityframework
I’m trying to insert a user that already exists in another database, but in the previous database, there was no validation of the Entity framework, so for example, the password could be 123456. So…
entity-frameworkasked 4 years, 2 months ago Mariana 2,512 -
2
votes1
answer91
viewsEntityframework Executesqlcommand not accepting parameter
I’m running the Executesqlcommand. In the right way, parameter doesn’t work: var SQL = "update POSTOFFICE set Status = 1 where name = '@url'"; dbMailEnable.Database.ExecuteSqlCommand(SQL, new…
-
2
votes1
answer271
viewsEntity framework Many-to-Many Ientitychangetracker error. How to resolve?
I have a Many-to-Many relationship and my tables are correct about the relationship in the database. The problem is that my insertion works perfectly when you don’t use an existing entity in the…
-
2
votes1
answer594
viewsLinq + Lambda, sub-query, distinct and not in, how to improve this query
I had the following syntax in SQL SELECT tbl_boleto.int_IDC, tbl_Admin.int_STATUS, tbl_Admin.int_CONVENIO, tbl_Admin.int_PLANO, tbl_Admin.int_RESTRICAO, tbl_Admin.str_URL FROM tbl_boleto INNER JOIN…
-
2
votes2
answers973
viewsInheritance X Composition - Mysql C# Entity
There was a doubt of inheritance modeling in C# involving the entities Pessoa, Pessoafísica and Pessoalegal, but Gypsy Morrison Mendez helped a lot! Now I have another question in another type of…
c# asp.net-mvc entity-framework inheritance compositionasked 8 years, 8 months ago Felipe Bulle 387 -
2
votes1
answer65
viewsEntity Framework - Relationship Association Problem 1 to 0.. 1
I have a problem of association between two tables. Student and Student Tables. Public class Aluno { [Key] public int cod_aluno { get; set; } ........ public virtual Aluno_Unidade_Curso…
asp.net-mvc asp.net-mvc-5 entity-framework entity-framework-6asked 8 years, 7 months ago Rodolfo Araujo 23 -
2
votes3
answers410
viewsCall a method automatically via a partial class on . NET
I created a partial class to the model users where I implemented some custom functions, such as a function that takes the assigned name and surname and generates a handle, see in the following…
-
2
votes2
answers808
viewsSearch Filter
I have an Items entity that relates to the product table and it is already in production and is working perfectly! Now I need to create a search report in which the user can determine through…
-
2
votes1
answer1323
viewsMap View - Entity Framework
I know it has been asked something similar, but in the answers I found said that to map the view should put the Dataannotation [Table("view name")] or configure in the Fluent API I created a view in…
-
2
votes1
answer774
viewsTransaction with multiple queries
I was visualizing that question, and to try to answer I decided to perform some tests where I could see the following problem: When conducting multiple queries to the Database via Entity Framework…
-
2
votes1
answer487
viewsHow to create master-detail form using a Viewmodel
I have a viewmodel in my project. Within it I have two entities that are a list of items. I’m doing the data editing logic of these entities that are inside the viewmodel. I have 5 entities in all.…
-
2
votes1
answer518
viewsWhere should I put Connectionstring in Windows Forms Applications with EF?
I have the following error using Entity Framework: Additional information: No Entity Framework Provider found for the ADO.NET Provider with invariant name 'System.Data.Sqlclient'. Make sure the…
-
2
votes1
answer352
viewsEntityframework does not recognize Config Web transformation
In my solution C#, I use transformation Web.config to connect a specific data environment, but I’m having a problem with EntityFramework who can’t recognize string de conexão transformed, only…
-
2
votes1
answer318
viewsSave a complex object with Entity Framework
The system has an Order screen where you can add new items or change items from that order. The object that is sent to the Repository layer is a complex object 1 x N, that is to say Pedido and…
entity-frameworkasked 8 years, 1 month ago hard123 2,329 -
2
votes1
answer230
viewsInaccessible logs error: Security
Good afternoon, I recently got the following error The source was not found, but some or all Event logs could not be searched. To create the source, you need permission to read all Event logs to…
-
2
votes1
answer138
viewsMany Relationship for Many ASP.NET Entity Framework
I am having difficulties to make the relationship between my tables using EF. When creating an Order, I need to list the data recorded in other tables, such as Equipment, Tasks and Person, as I try…
-
2
votes2
answers147
viewsHow do I migrate Code First without deleting data from the table attribute?
I need to change the attribute name of Heaviness for Pesoproduct, this is the code that is generated after executing the command add-Migration: namespace Web.Dominio.Migrations { using System; using…
-
2
votes3
answers682
viewsHow to mount a lambda expression and pass it by parameter to a Generic function?
I need to pass two parameters to a generic function that returns database data and select only a few specific columns to display in one DataGridView. public List<TEntity>…
-
2
votes2
answers100
viewsSQL query for Linq mvc4 c#
I’m not very familiar with Linq and I’m having a hard time turning this SQL query into Linq, can someone help me. I do the join of 6 tables (it wasn’t me who made the database. I have to work with…
-
2
votes1
answer138
viewsWhen changing a Model, how to redo Scaffolding?
I have a model, called CombustivelModels, where I made a Scaffolding generating the Controller and the Views, my doubt is, when making a review on that Model, has how to update via Scaffolding the…
-
2
votes1
answer135
viewsError while logging in applications
Well, here’s the scenario: Have 2 applications ASP.NET MVC on the same project, which are using a Dominio in common. I’ll call it MVC1 and MVC2 to get better at exemplification. I installed the…
-
2
votes1
answer198
viewsN for N Entity Framework
Dear, I am trying to carry out a relationship N to N in the Entity Framework for the tables described below. At the moment what is happening is a cyclical redundancy, where every time I open a…
-
2
votes1
answer42
viewsIs it possible to see the Entity execution order?
So, is it possible for me to look at the execution order of the Querys that the Entity Framework mount? My problem is that it is trying to make a deletion in the wrong order, even after I make the…
entity-frameworkasked 7 years, 11 months ago AbnoanMuniz 181 -
2
votes2
answers116
viewsDbcontext finds Connection String in Web Project, but not in Console App project
I have a project Class Library which contains the context, configuration files and access classes to the database. His reference in an Asp.Net MVC project works normally, he accesses the data and so…
-
2
votes1
answer204
viewsHow to create a compound index in Sqlite via Microsoft.EntityFrameworkCore.Sqlite?
I’m trying to create a unique composite index, but I don’t know how to do it on Microsoft.EntityFrameworkCore.SQLite, I’m used to working only with the Doctrine and Hibernate and I’m totally lost.…
-
2
votes2
answers266
viewsAssociation 1 to 1 Entity
I have a relationship between Address and Academy where 1 address has 1 gym, and 1 gym has 1 address. Academia class: public class Academia { [Key] public int AcademiaID { get; set; } ...…
-
2
votes1
answer65
viewsSave and update entities
or personal I am trying to give an improved in my generic method that adds and updates, follows the code: public void InsertOrUpdate(T entity) { if (entity.Id == 0) {…
-
2
votes1
answer278
viewsInserting and updating data in N-N tables (many to many)
I’m having trouble saving in a relationship of many to many, follows my model: public class Pessoa { public int id { get; set; } public string descricao { get; set; } public ICollection<Conta>…
-
2
votes1
answer831
viewsHow to select a select using the ado.net Entity Framework
I’m developing a system in ASP.NET MVC which uses as standard the Entity Framework for data access, but I am in need of a select on another select, and I don’t know how to do this with Entity. The…
-
2
votes1
answer49
viewserror with EF and Mysql query
I have the following consultation: var produto = (from a in context.ItensReceita join b in context.Receita on a.t0080_id_receita equals b.t0080_id_receita join c in context.Medicamento on…
-
2
votes1
answer95
viewsQuery using Entityframework why the performance variation?
I have the following querys using Linq to Object: _Context.GerenciaTransacao.Where(x => x.Placa == "LUN1320").ToList(); in this query, the results return in 100ms. and string placa = "LUN1320";…
-
2
votes3
answers554
viewsUsing the Case When Then command with Entity Framework
I have the following structure corresponding to a table in my database: Cat_Codigo, Cat_Descricao, Cat_Observacao, Cat_Status Where the Cat_Status is defined by 0 or 1, with 0 -> Deactivative and…
-
2
votes2
answers66
viewsInclude all child objects (navigation properies) in the Entity search
I wonder if it is possible to search the object completely filled without calling the include specifying each child object (with their respective children) of my class. Currently, I’m doing so:…
-
2
votes1
answer23
viewsEntity Framework - Lazyload with null-enabled property
What happens to a search that uses the include of Entity Framework on a property that can be null. var ocorrencia = db.Ocorrencia .Include("Pessoa") .FirstOrDefault(c => c.id == 3); That object…