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
-
1
votes0
answers69
viewsError Performing Update on Entity Framework
I have the following relationship between Agenda and Contact: An Agenda may have N Contacts; A contact can be in N Agendas; In other words, I have an N:M relationship between the Agenda and Contact…
-
1
votes0
answers90
viewsEntityframework error
Could someone help me ? I’m trying to do Codefirst and when I execute the command I get this error: The 'System.Data.Entity.Internal.Appconfig' type initializer triggered an exception. My Appconfig…
-
1
votes1
answer48
viewsMap Procedure in Entityframeworkcore
I am using Entityframeworkcore 3.0 together with Stored Procedure. The Procedure sp_login returns the following data: cod_us A B C D E 111342 1 1 1 0 0 111342 1 2 1 1 1 111342 1 3 1 1 1 Models:…
-
1
votes1
answer56
viewsOne-To-One relationship with EF?
I’m trying to create a relationship OneToOne with EF6. In my scheme I have a User class and a Plan and the relationship would be 1 User has 1 Plan, however, this relationship is done when the User…
-
1
votes1
answer136
viewsEntity Framework Core relationship creation one to Many
public class Evento { public int Id { get; set; } public string Nome { get; set; } public Categoria Categoria { get; set; } public CasaShow CasaShow { get; set; } public float QuantDeIngressos {…
-
1
votes0
answers32
viewsInsert record Many-to-Many - EF Core
Problem: Error overflow when trying to create record in table with relationships. Error when I pass the virtual members with their type instance: The bank returns saying it cannot find the key…
-
1
votes0
answers125
viewsUnion All for Entity framework using Lambda
I’m having problems in a query using lambda and Entity Framework in C#. When transforming a simple sql query into lambda works perfectly, as example below. SQL query public DataSet ListarRecebidos()…
-
1
votes1
answer73
viewsIn a banking scenario with high transaction volume Code First can be higher than Database First or vice versa?
I am architecting the development of a backend structure composed of microservices for a financial institution. Probably the biggest project I’ve ever worked on, and I’m having serious doubts about…
-
1
votes0
answers35
viewsPerforming Groupby with Linq?
I’m trying to perform a Groupby but I’m not getting it. Always returns an Exception that I’m not able to solve. How do I solve this problem ? LINQ public ActionResult MeusConcursos(){ Usuario…
-
1
votes0
answers32
viewsAdd a line in a Datagridview with a QUERY as Datasource
First I created a DGV and configured it the way I need, put the column names and formatted column by column the way I need, adding the default value for null, text formatting, type of input, etc..…
-
1
votes0
answers18
viewsHelp with Entity framework
Hello everyone I have sequinte select, which joins 3 tables. This select works in the bank. I would like to make this same select using Entity with Asp.net mvc. But I have no idea how to do it. Any…
-
1
votes0
answers39
viewsIs it possible for an entity to have 2 N-to-N relationships using Entity Framework?
I have 2 models: Cliente and Empresa, which need to have registered addresses. I created another template called Endereço to make the relationships N for N, in which it stayed this way: public class…
-
1
votes0
answers49
viewsRelationship 1-1 and circular reference
I’m running a very simple test, where I have two entities with a 1-1 relationship between them: public class User { public int Id { get; set; } public string FirstName { get; set; } public string…
-
1
votes2
answers37
viewsEntity Framework -> How to find the largest table elements
I have the following tables in my base: Produto Id | Nome | Preco 1 | fone | 100 2 | copo | 50 3 | pao | 10 ProdutoStatus IdProduto | Versao | Preco 1 | 1 | 101 1 | 2 | 110 1 | 3 | 90 2 | 1 | 55 2 |…
sql-server .net entity-framework asp.net-core entity-framework-6asked 3 years, 9 months ago Guilherme Golfetto 743 -
1
votes0
answers95
viewsHow should I test an EF core repository with xunit
I’m currently testing a repository as follows: public class SomethingTest { [Fact] public async void GetKeyValuesAsync_NotNull() { // Arrange var categoryRepository = CreateRepository(); var fixture…
-
1
votes0
answers37
viewsHow, after a POST request, to insert values into another table automatically with the Entity Framework
Good night! I have the following question: I have 3 tables (Students, Etapasala, Classroom) As you can see, Etapasala is a connecting table between the student and the classroom. I’m using the MVC…
-
1
votes0
answers25
viewsHow to use EF Core Code First in Azure Synapse
I’m trying to use migrations to manage database schemas with Entity Framework Core and C# in Azure Synapse, when I run the update-database command I get an error message as described below: Enforced…
sql entity-framework windows-azure entity-framework-core azure-synapseasked 3 years, 7 months ago Carlos Lemos 324 -
1
votes1
answer40
viewsReturn Iqueryable in the method
I am using Identityframework in my project and need to create a method that returns a Iqueryable Follows below class structure: namespace MeuProjeto.Controllers public class UsuariosController :…
-
1
votes1
answer25
viewsSqlserver Field Identity jumps to 1001
I noticed that one of the tables had a balance from 9 to 1001. At first I imagined that some colleague would have done a test in the bank and deleted the record in sequence causing the number to…
-
0
votes3
answers403
viewsLog reading to infer counter
I have a template called Request and this template has a column called Number. This number has the following structure: YEAR + COUNTER. It just so happens that every time I create a new request I…
-
0
votes1
answer851
viewsUpdating edmx file is not working
Whenever I do: UPDATE MODEL FROM DATABASE on top of my edmx file, it does everything right, including shows the table to be updated or the fields. It doesn’t make any mistakes, it acts as if…
-
0
votes1
answer579
viewsWhy is the Entity Framework generating a new record in the database?
Next, I’m working on a new project Asp.net-mvc, and I have 3 classes. public class Anuncio { public int AnuncioID { get; set; } public string UsuarioID { get; set; } [Required] [MaxLength(255)]…
-
0
votes2
answers76
viewsError using store Procedure - Entity
I used a store precedure for authentication in my application as suggested... insert link description here But now you’re making the following mistake...…
-
0
votes1
answer1027
viewsHow to return the value of an Entity Framework field c#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using…
-
0
votes2
answers4814
viewsForeach within a cshtml(view) from a controller
I made a code using Linq and jQuery. Turns out you’re giving me a problem I can’t solve, which is creating a Treeview dynamically. Then I had another idea. To do the foreach right in the View…
-
0
votes1
answer495
viewsEntity Framework without primary key
I have the following problem: Every time I update the Diagram model of my project, it loses the reference of which field is the primary key, even I try the PK in the table in my Database. Does…
-
0
votes1
answer159
viewsUsing Existing Database with Entity Framework
I am in need of a help to know if there is a way to use an existing database with Entity Framework without having to use the Visual Studio import, and without using the Database First because I…
entity-frameworkasked 10 years, 1 month ago Rabelos 161 -
0
votes1
answer404
viewsWorking with Entity Framework, Multithreading and SQL Server in C#
I’m using the Entity Framework and Multithreading on a project C# and I am going through problems of connection with the SQL Server. Well, I wanted to improve the speed of some data searches for a…
c# sql-server entity-framework linq multithreadingasked 10 years, 1 month ago Vinicius Botelho Bizarri 1 -
0
votes1
answer347
viewsPopular a List with database data accessed by Entityframework
As popular as mine List, in C#, with the data stored in the database accessed through the Entityframework? Current code: public static IEnumerable<Contato> GetAll() { return new…
-
0
votes1
answer289
viewsHow to map a table without PK with entityframework?
Guys! in my project ,I am having difficulties in mapping a table without Primary key(PK),The application is breaking,when I implement the table in the MAP of my project. public class Configuracoes {…
-
0
votes1
answer309
viewsLeft Join on the Linq is giving error in more than two tables
I did that last breath: var resultado = ( from pdv in db.T_PDV join tarefa in db.T_TarefaParceiro on pdv.CNPJ equals (tarefa.CNPJ) into _trf from g1 in _trf.DefaultIfEmpty() join parceiro in…
-
0
votes1
answer398
viewsHow to work with Database Views on ASP.NET MVC?
Views doesn’t have a primary key so it causes me to make a mistake: Error: The number of Primary key values passed must match number of Primary key values defined on the Entity. How could I avoid…
-
0
votes2
answers1013
viewsC# MVC EF5 delete relationships
Hello, I am developing an application using C# MVC and EF5 and I have the following problem: I have a customer group management screen, in this group I can insert and remove customers, I use a…
-
0
votes2
answers1066
viewsContext does not load database data
My context is not bringing the database data. Error messages. Value cannot be null. "Value cannot be null. r nName of parameter: Connection" Value cannot be null. Name of parameter: Connection Cód…
-
0
votes1
answer124
viewsInsertion 1 for many is recording two records in the database
I have the following classes: Usuario, Noticia, Bloco and Editoria. I had a relationship One to Many between the tables Noticia and Editoria, Noticia and Bloco. It works perfectly, by putting the…
-
0
votes1
answer52
viewsDependency on services
I have a job that closes a back door. Like any input process when registering the note I have the manual registration of each item of the note and when closing the note I need to update the stock of…
-
0
votes1
answer78
viewsSave fk right after pk is generated with Entity
I have a system and this system has some tables that are associative. As soon as I write the main table in the comic book, I need to make sure that that new generated PK is recorded in three other…
-
0
votes1
answer83
viewsEntity Framework 1-n
I don’t even know if you’ve been feeling what I’m trying to do. If I try to add a Course to a Flag, that’s fine. But when I try to add a Course list to a Flag, the following error occurs: Additional…
-
0
votes1
answer615
viewsTake Model in View with values from the database
I have that class: public class MontaArvoreAcao { public int IDRuptura { get; set; } public DateTime DataRuptura { get; set; } public int IDMotivo { get; set; } public string Motivo { get; set; }…
-
0
votes1
answer115
viewsEntity Framework and WCF navigational property
I am trying to implement a WCF service that will return a Model that I also use in the Entity Framework. When the model has a property virtual from navigation to association with another model WCF…
-
0
votes1
answer662
viewsLINQ with Left Join and Multiple Keys
My LINQ query does not give error but does not show any result. Where I made a mistake? using (var db = new MyEntities()) { var result = (from dc in db.DiarioClasse join fn in db.Faltas on new {…
-
0
votes1
answer233
viewsSelect in Entity Framework is not working
I am performing a consultation using LINQ, very simple query I am using the following method. public void verificaAcesso( string usuario, string senha) { using (DbBancoContext banco = new…
-
0
votes1
answer183
viewsDisplay the full list of tables on an Oracle connection with Entity
As I do in a connection to the Oracle database, show all tables. made a connection and I have over 500 tables in the bank and only shows 74, that the three I need to mount the POC that I’m doing,…
-
0
votes1
answer61
viewsList string in 2 MVC tables
I have 3 models: Pessoa, Catequizando and Inscricao. I intend to make a query that returns the name of the person where CatequizandoID = PessoaID that will appear in a dropdown view CriarInscricao I…
-
0
votes1
answer292
viewsSelect in two tables
Ban.cs public partial class Ban { public int IdBan { get; set; } public System.DateTime DataBan { get; set; } public System.DateTime DataDesban { get; set; } public int Usuario_IdUsuario { get; set;…
-
0
votes2
answers627
viewsHow to save an attribute to image
I need to save an image and say I have something like: namespace Projeto.Models { public class Usuario { public int UserId { get; set; } public String Nome { get; set; } public ? Foto { get; set; }…
-
0
votes2
answers52
viewsPrevent the user from voting in the same Post
I created a voting system, where users can give like/dislike in the chapters of books posted on the site. Follow my action: public ActionResult Like(int id) { int iduser =…
-
0
votes1
answer1056
viewsEntity Framework DDD Generic Infrarepository
How to do JOIN via lambda in the generic repository. I’m following the DDD architecture model. Example: public class BaseRepository<T> : IRepositoryBase<T> where T : class { private…
-
0
votes1
answer27
viewsError in project.json file
I have an error in my project, it appeared after I added Entity Framework to my project! This error persists on line 21 of the file project.json. I’m using Visual Studio 2015. The exact description…
-
0
votes2
answers71
viewsPrefix (stackify) + Web Api + MVC + EF 5 is not monitoring querys
Good Afternoon. Guys, I’m not being able to use Prefix (stackify) + Web Api + MVC 4 + EF 5, because it is not being able to monitor the querys performed and perform the information return. In the…