Most voted "entity-framework-6" questions
It is a set of ADO . NET technologies that supports data-driven application development.
Learn more…371 questions
Sort by count of
-
24
votes3
answers4038
viewsWhat is the difference between using virtual property or not in EF?
I have my models public class Cliente { public int Id {get;set;} public string Nome {get;set;} } and public class Pedido { public int Id {get;set;} public int ClienteId {get;set;} public virtual…
-
15
votes4
answers957
viewsMultiple Contexts Migrations Entity Framework
I have several projects and each project has a context. I would like to know, how to use the Migrations to update and generate only one database of these various contexts?
-
13
votes1
answer498
viewsWhen does the Entity Framework execute the query of a Iqueryable?
I am developing a method for an API that consists of the following: fetching all customer reviews and, if specified, limiting the amount of records that will be returned. For example: public…
-
11
votes2
answers309
viewsWhat’s the difference between Savechanges and Submitchanges?
Within the context Entity Framework what is the difference between SaveChanges and SubmitChanges? When I should wear one or the other?
-
10
votes1
answer2783
viewsHow to create a login and password page in ASP.NET?
I’m trying to create a login control for my application but I’m not finding a way to do that. I would like it to be a complete login control, where I can register new users, recover their passwords,…
-
8
votes2
answers1261
viewsHow to get all records from a mixed table generated by class inheritance when using Entityframework 6?
I have a class structure in the following form: public class Pessoa { public int Id {get; set;} public string Nome {get; set;} } public class Membro : Pessoa { public int CargoId {get; set;} public…
-
8
votes2
answers732
viewsHow to structure a solution by separating Webapi from Webui using ASP.NET Identity?
How should be organized a solution that will have at least three projects, being them: Class Library as infrastructure Web Application as Web Api Web Application MVC for Webui (user interface) Where…
-
8
votes4
answers1003
viewsProblem saving a change using Entity Framework
I am trying to persist a change I make to a record but am getting this error: System.Invalidoperationexception: 'A referential Integrity Constraint Violation occurred: The Property value(s) of…
-
7
votes2
answers6973
viewsMany Relationship for Many Entity Framework 6
Good morning, I have the following classes: Consul_ca_student: public class CONSUL_CA_Aluno { public int Id { get; set; } public string Nome { get; set; } public int Cpf { get; set; } public string…
-
7
votes1
answer1281
viewsGood Practice when modularizing an application with EF and multi-bank
Let’s say I want to model an application on .NET using the EntityFramework as ORM and use one of its advantages, to be "generic" for several RDBMS. So, for example, I want my application to agree to…
-
7
votes2
answers5492
viewsRelationship 1 to 1 with Entity Framework
I have 2 entities: Equipamento and Databook. A Equipamento can only have one Databook and a Databook is only for a Equipamento. How can I make this relationship with Entity Framework? Follows the…
-
7
votes2
answers1573
viewsHow to access next and previous record with C# using Entity Framework
I am developing a Windows Form application, with Entity Framework 6 + Mysql. As is common in systems, I have in each form navigation buttons (First Record, Previous Record, Next Record, Last Record)…
-
7
votes2
answers65
viewsWhat to do when a model has N responsibilities
My system exists a class that is currently a common class for several situations, below some of the other models to exemplify public class Servico { public int Id {get;set;} public string Nome…
-
7
votes1
answer94
viewsUpdate to 2K records <Clients> how to do a single update instead of 2k separately
I have a Customer Model and need to do an update on EnviadoEmailCobranca para 0 I’m doing like this: var clientes = db.Clientes.Where(w => w.Status == 4); foreach (var item in clientes) {…
-
7
votes2
answers195
viewsLINQ query with sum
I have the following appointment at LINQ var dados = _db.Contratos .Where(a => a.Adesoes.Any(b => b.Pago)) .Select(a => new { Contrato = a.Numero, ValorTASenior = a.Adesoes.Where(b =>…
-
6
votes1
answer1827
viewsHow to know which SQL is generated by the ORM Entity Framework?
With the use of ORM, and the practice employed we forget that they generate SQLs and return Objetos (vice versa). How can I find out at runtime the SQL generated by Entity Framework right in the…
sql entity-framework entity-framework-6 lambda-expressions linq-to-entitiesasked 10 years, 6 months ago user6026 -
6
votes1
answer475
viewsWhat can cause the RU’s performance to fall in this scenario?
I’ve been making a data import for a project on ASP.NET MVC 5 with EF 6.1 and SQL Server 2008 where the import data source was a file txt. The record lines of the file were not very large but…
-
6
votes2
answers3589
viewsEntity Framework 6 does not create database
I created a c# WEB MVC5 project in visual studio 2013, installed Entity framework 6 and created my classes("entities") as well as Dbcontext with the respective Dbsets. Inside the WEB.Config I set up…
-
6
votes1
answer1657
viewsEntity Framework - What is the difference between With Entitystate.Modified and Without Entitystate.Modified?
What’s the difference between the two ? With Entitystate: var registro = db.MinhaTabela.Where(a => a.MeuCampo == "Valor_Antigo").FirstOrDefault(); registro.MeuCampo = "Valor_Novo";…
-
6
votes1
answer166
viewsAdd property in relation to N-N
How to add properties (columns) in an N-N relation using EF? For example, I have the class Produto: public class Produto { [Key] public int ProdutoID { get; set; } public string Descricao { get;…
-
6
votes1
answer522
viewsEntityframework 6 + Lazyloadingenabled + using()
I need a help. My problem is this: I cannot return my object items. Follow my code for analysis. Client class public partial class Cliente { public Cliente() { this.ClienteEndereco = new…
c# asp.net-mvc entity-framework-6 lazy-loading repositoryasked 9 years, 7 months ago Henrique Abreu 379 -
6
votes1
answer4952
viewsHow to update a datagridview automatically?
I created an application that will display the data of a particular view in a control datagridview. The entire application is already ready: the data upload, the update button and also the events…
-
6
votes1
answer813
viewsSelf Relationship in EF
I’m having the following problem creating two self relationships. When rotating the Update-Database The following error message appears: Unable to determine the main end of an Association between…
c# entity-framework asp.net-mvc-5 entity-framework-6 code-firstasked 8 years, 4 months ago Lucas Ost 319 -
6
votes2
answers905
viewsHow to create a sequential number that does not repeat, per user
Work on a bill issuance project, in this project exists the entity Emissor. My database Sql-Server may have several emitters. Each issuer can issue their tax bills. Each invoice shall have a…
-
6
votes3
answers1299
viewsShould every table have Primary key?
I believe my question is both conceptual and technical. My whole problem started when I made an SQL Server database and in it there were some tables without primary key, such tables would serve…
c# asp.net-mvc sql-server entity-framework entity-framework-6asked 5 years, 6 months ago Nelson Francisco 147 -
5
votes1
answer406
viewsHow to map a TIME-like column in Entity Framework 6?
I am using this mapping to a SQL Server DATETIME field: Property(X => X.DatNascimento).HasColumnName("DAT_NASCIMENTO").HasColumnType("datetime"); But I have another field that is only TIME that I…
-
5
votes1
answer206
viewsDoubt with Codefirst Entityframework
I’m starting in Entity Framework and I have a question regarding Codefirst. Why I have to use as virtual some properties like the example below? [Table("Grupo")] public class Grupo { public int ID {…
-
5
votes2
answers439
viewsEntity Framework | Double property that allows null
My property allows values double and values null. In the SQL Server Database it is set to decimal(18, 2). But when seventh some value (ex: 5.00), makes the mistake below. Error: The 'Rating'…
-
5
votes1
answer44
viewsEntity Framework 6 error logging in Sqls
I’m trying to see the Sqls run by Entity Framework, use version 6. I’m following this guide. I made a new Dbcontext using the graphical interface. 5 tables only. The code is inside an API2 Web…
-
5
votes2
answers200
viewsWhat’s the opposite of . equals in C#?
I’m doing a left Join where I want to pick up just what’s on the left table and there’s no right one. I’m using LINQ and Entityframework. I made a code that takes the similarities, follows below:…
database .net entity-framework entity-framework-6 ormasked 5 years, 1 month ago Garota de Programas 57 -
5
votes1
answer170
viewsEF is giving Timeout in a query that should be instantaneous
When I run the SQL generated by the direct EF on Sqlserver it runs with less than 1 second. When it runs through the timeout application it takes more than 30 seconds. I’ve seen a lot of this…
-
5
votes1
answer233
viewsHow to test an Asp.net mvc controler using Moq and Entity Framework 6
My controller: [Authorize] public class DominioController : Controller { private IDominioDB _db; public DominioController(IDominioDB db) { _db = db; } // GET: Dominio public async…
-
5
votes1
answer1179
viewsError entering data into database, EF 6
I’m trying to input data into the database, but I have a mistake in doing the saveChanges(); after doing several times the context.add(), has happened after 500, 2200 and 5500 times. Error: The…
-
5
votes2
answers2096
viewsMysql and C#inheritance modeling
I have a question about modeling a Desktopapplication system in C# with Mysql. Essentially I will have the entities Customer, Supplier, PF and PJ. PF can be a customer or supplier. And PJ can also…
-
5
votes2
answers56
viewsWhy is it that when I delete or edit the record from table x it is also removed from table y?
I have a system in ASP MVC with C# using Entity framework. I have the table Pedidos and Agenda. On the table agenda I have a column with the id of the request. When the order is canceled, I have to…
-
5
votes1
answer257
viewsEntity Framework Async Performance
I am implementing an asynchronous webapi, and have tested two ways to return the value with EF6. The 1st form was using Tolistasync(), and the 2nd form was using Task. The 2nd form has a much better…
-
5
votes1
answer459
viewsError Connecting Postgresql to Entity Framework
I am trying to connect the EF in Postgresql. You are presenting the following message: An unhandled Exception of type 'System.Configuration.Configurationerrorsexception' occurred in…
-
5
votes1
answer142
viewsDouble map the same entity
I’m trying to map the same entity twice into another public class Conveniado { public int Id { get; set; } public string Nome { get; set; }…
-
5
votes2
answers127
viewsHow to use Groupby according to parameter?
I have my Model account as below: public class Conta { public int Id {get;set;} public int ClienteId {get;set;} public Cliente Cliente {get;set;} public int ContaBancariaId {get;set;} public…
-
4
votes1
answer145
viewsHow to change the type of the persisted class in a legacy model using the Entityframework
I have the following class scheme with inheritance, as an example: public class Veiculo { public int Id { set; get; } public string Descricao { set; get; } } public class Moto : Veiculo { } public…
-
4
votes1
answer1289
viewsCustomizing Asp.net Identity - Multiple classes as User in Identity
We know that our user on Asp.net Identity is the class named after ApplicationUser I would like to create other classes that inherit from her Why? Why, say I have the Customer, Seller, User class. I…
-
4
votes2
answers92
viewsSetar schema in query with Repository
I have my Repository: public class RepositoryBase<T> where T : class { protected AppDbContext _context; protected IDbSet<T> _dbSet; public RepositoryBase() { _context = _context ?? new…
-
4
votes2
answers290
viewsHow to insert Entities, related to other existing ones, into the Entityframework?
In the case assuming an entity "Entidadea" that references an entity "Entidadeb", I want to save it, but referencing an entity B already existing ex: EntidadeA a = new EntidadeA(); EntidadeB b = new…
-
4
votes1
answer818
viewsWhat is the Dynamic Proxy generated by the Entity Framework?
What is the Dynamic Proxy generated by the Entity Framework? And a class? What is its function?
-
4
votes5
answers6761
viewsHow to create composite key with Entity Framework 6
I have my model base that all classes inherit from it: public class Base { public int Id {get;set;} public int ClienteId {get;set;} } And an example of model: public class Grupo: Base { public…
-
4
votes2
answers576
viewsHow to create 1-N class relationships with more than one property and even subtype?
I have the following class structure, unconventional but it’s in the mold that I need to solve my problem: Tree: public class Arvore { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]…
-
4
votes2
answers646
viewsIs it possible to work directly with Entityframework fonts?
It is possible to work directly with the Entity Framework and power "thresh" within their classes and methods? I downloaded the zip from his code Codeplex. I unpacked in a folder and in my project I…
-
4
votes1
answer54
viewsError adding migration with Migrations
I am trying to add a migration and Migration returns the following message: The Designer Code for this Migration file includes a snapshot of your Current Code First model. This snapshot is used to…
entity-framework-6asked 9 years, 3 months ago Kelly Soares 1,181 -
4
votes1
answer294
viewsIs it possible to make a condition within a Select?
I’m performing a consultation using Select, to select only the required fields and consequently have higher performance. In my View user can choose certain fields to be loaded Man ViewModel public…
-
4
votes1
answer493
viewsHow to mount SELECT in lambda C#?
I recently asked for help to assemble a SELECT to bring the price of products How to mount SELECT They gave me this solution that worked perfectly: SELECT P.PROCODIGO, P.PRONOME, H.HISPRECO FROM…
c# sql select entity-framework-6 lambda-expressionsasked 8 years, 10 months ago André Morais Martins 367