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
-
3
votes1
answer48
viewsEntitiy framework for JAVA?
Good evening, guys, I’m new to programming. So, I’ve been looking at some articles and watching videos about the Entity framework for C #, I wonder if there are also some frameworks in Java that do…
-
3
votes1
answer95
viewsDoubt when configuring entities relationship
In a hypothesis, I have an entity to register addresses: public class Endereco { [Key] public int EnderecoId { get; set; } public string TipoLogradouro { get; set; } public string Logradouro { get;…
-
3
votes1
answer157
viewsLinq groups and fetch max id
Is there any way to optimize the code below so that you search the forms that have the maximum version according to the IdCentroCusto? In the code below I’m doing the grouping and catching the…
-
3
votes1
answer385
viewsSelf Relationship with Entity Framework 2.2
How to Make a Self Relationship with EF Core 2.2? I found a link that teaches to do with EF, but in EF does not have the Withoptional method. public class Menu { public int Id { get; set; } public…
-
3
votes1
answer501
viewsFill in date and time in View mvc 5 Razor
I have a registration form where I have a record date field that I currently fill in my save method, only that my server is hosted in another country where the field is being filled in from the…
javascript c# entity-framework asp.net-mvc-5 asp.net-web-apiasked 5 years, 11 months ago Thiago Ubiratan 353 -
3
votes1
answer497
viewsEntity Framework Migration - Indicate migrations as executed
I am working on an ASP.NET MVC system with Entity Framework, which uses Migrations. Has the following initializer: public void InitializeDatabase(Contexto context) { if (!context.Database.Exists())…
-
3
votes1
answer291
viewsWhat’s the Context class for?
I am developing a system in ASP.NET MVC with mapping using the Entity Framework, when observing some patterns I see a lot the use of the class Context, what it’s for and what it should contain…
-
3
votes1
answer109
viewsIs it feasible to migrate from long to Guid?
Using Webapi, . NET Standard, C#, Entity Framework - Codefirst The records in long may exceed their limits. It is feasible to change long for Guid the primary key with the populated bank and running…
-
3
votes0
answers44
viewsHow to update classes at runtime? EF C# MVC
I need to update my application’s classes because it has a function in my controller that creates a new column: public string ListarMapeamento() { banco.Database.ExecuteSqlCommand("ALTER TABLE…
-
3
votes1
answer137
viewsEntity Framework returns any type of data with Sqlquery
I’m trying to return dynamic values of a query also dynamic, but I can’t figure out how to get any kind of data from the database. Here’s what I’m trying to do comandoSql = @" SELECT " + NomeCampo +…
-
3
votes0
answers67
viewsLoad information inside the lambda and use in lambda foreach
I created a property in the class CatalogItemResponse to use in a method, but Boss asked to take it. It turns out I need it to load another property and without it I’m not getting it. This is my…
-
3
votes1
answer89
viewsConvert all strings to lowercase
There is a way to configure the modelBuider, to lower my strings? For example, when I want all my data of type string, be at my bank a varchar, i make the following configuration:…
-
3
votes1
answer221
viewsLinq - Searching for objects that have a predetermined list
I have an entity from Many-to-Many, many students for many subjects. And I need to get all students who possess all the subjects I desire. For example, subjects: Mathematics, Portuguese and Physics.…
-
3
votes1
answer249
viewsComplex Entity Framework Update
Good morning, I have asked a similar question, I am trying to complement this see with more information and starting from the most basic. I have the following structure: public class Artista {…
-
3
votes1
answer93
viewsDbentityentry.State vs Dbpropertyentry.Ismodified
I have a question about these two ways to specify whether an entity has been modified. I usually use DbEntityEntry.State with the EntityState.Modified when I make a very big change in model and I…
-
3
votes2
answers1790
viewsData Search with Entity Framework
I have a project in Asp.Net MVC where I need to work with a large volume of data. To get them from the Database (Microsoft SQL Server) using Entity Framework 4 I know basically three ways: first…
-
3
votes2
answers310
viewsProblem with Valueobject in the Entity framework
I’m having a hard time with a mapping and I’d like to know if it’s possible to do that: I have a Contact class with two fields that are Valueobject type "Phone", the fields are Phone and Mobile.…
-
3
votes3
answers2266
viewsEntity Framework [Foreignkey]
Reading a tutorial on Entity framework, I came across a somewhat strange example for me. This example is about Dataannotation [ForeignKey] public class Student { public Student() { } public int…
-
3
votes3
answers720
viewsDropdownlistfor how to use?
I’m having a question on how popular and then pick up the selected item from a DropDownListFor, I am using DDD architecture and Entity Framework. In case here my class ServiceProviderViewModel has…
-
3
votes2
answers167
viewsView with Ienumerable and Entityframework
I own a Sales entity and it has several fields (Iditem, Datavenda, Valorvenda, Taxadesconto, Idcliente, Idcategorito and etc). I already have all Views working for this entity(CRUD). Now I will…
-
3
votes2
answers940
viewsFile import and read
I have an Asp.Net MVC project with Entity Framework 4 and SQL Server, where there is a Action who receives via POST an archive csv. Taking into account the use of memory, processing time and…
-
3
votes1
answer441
viewsGeneric Dbcontext Dbset Method with Entity Framework
I have an application in C# using Entity Framework. All of mine DbSet of DbContext, I extend them to have a default search for the grid, below example of the method. public static GridDTO…
-
3
votes1
answer492
viewsCreating Models that derive Identityuser or use the Aspnetusers table
I am developing management software for my gym. I have Students, Teachers and system users. I installed the Identity. I created a model calling for Aluno who inherits from the IdentityUser public…
c# asp.net-mvc entity-framework modeling asp.net-identityasked 8 years, 2 months ago Dorathoto 7,426 -
3
votes3
answers151
viewsHow to create extension methods in the Entity Framework using Linq?
You can create custom extension methods for Linq to entities? In the project I work, for example, we have several columns of type DateTimeOffset?. In certain views I need to filter the results by…
-
3
votes1
answer399
viewsAlternative to the Transactionscope
I’m using Entity Framework (version 4.4) in a project Aspnet MVC with .NET Framework a little old (version 4.0) and SQL Server. I do not have access to the server where the application is hosted,…
-
3
votes2
answers371
viewsWorking with Seed + FK Method
I’m finding it difficult to work with the method Seed, Because I register the state, and right away I wanted to register the cities, and then I can’t reference the state in the city, what could I…
-
3
votes2
answers220
viewsInheritance problem
I have a problem with a bank search, I will try to explain in the best possible and clearest way. I have a table Pessoa and a table Cliente, the last inherits from Pessoa, I also have a table…
-
3
votes2
answers1303
viewsWhat is the difference between creating a Context with Dbcontext and Datacontext?
What is the difference between creating a Context with Dbcontext and Datacontext? Is there any difference in performance or best practice between one or the other? See the examples below; namespace…
-
3
votes3
answers182
viewsLinq filttar elements of LEFT JOIN
I would like to return an object with your children, but I just wanted you to bring the children that corresponded to a certain condition. ex: I have the following classes: public class Fornecedor {…
-
3
votes2
answers96
viewsEntity Framework - tables not created
I am following an Entity Framework booklet, created the classes: public class k19Context : DbContext { public k19Context() : base("k19Context") { } public DbSet<Turma> Turmas { get; set; }…
-
3
votes2
answers347
viewsIgnore a specific Exception
In my try-catch, I want to record the exception that occurred within an object (for historical effect, necessary for the business rule, since this section takes place in a processing via integration…
-
3
votes2
answers76
viewsEntityframework Aspnet Core Migrations
Good evening, I came across a problem to update the DB of an Aspnet Core application. Had created the bank, but ended up deleting, now, while trying to create again using the following commands:…
-
3
votes1
answer4100
viewsThe ADO.NET Provider with invariant name 'Mysql.Data.Mysqlclient' is either not Registered in the machine or application config file
I have an MVC project, and I wanted to connect to the Mysql database. I put this connectionStrings. <add name="Contexto" connectionString="server=127.0.0.1;User…
-
3
votes1
answer1020
viewsMysql connection does not appear in Data Connection
I updated my Visual Studio to 2017 version and am trying to connect to a Mysql database through Entity Framework. What happens is that the option for connection in Mysql does not appear: Only SQL…
-
3
votes0
answers62
viewsuse Sqldependency with [ORM]
I am developing a service that must perform a procedure whenever a record as a certain condition is entered in the database. However, despite using the SqlDependency, I’m not using the SqlCommand,…
-
3
votes1
answer675
viewsGeneric Query with Predicatebuilder and Linqkit
I’ve been using Linqkit to create generic queries for a long time. One thing that always bothered me is that I always have to test if the value sent in the filter is valid. For example: Suppose I…
-
3
votes1
answer35
viewsBatch persisting in Many-to-Many Entity with extra fields
I have the following question: If I have an N to N relationship: Products and Coins. At the time it would persist would be 1 Product with a list of 10 Coins. public class Produto { public int…
-
3
votes1
answer110
viewsDoes "Join" make the search faster?
I have two tables, one of patients and the other of consultations. In short, the tables have the following structure: Patients int id; string nome; string cartaoSus; Consultation int id; int…
c# entity-framework linq lambda-expressions linq-to-entitiesasked 7 years, 4 months ago Italo Rodrigo 4,344 -
3
votes2
answers343
viewsMany to Many with Fluent API
I’m doing a mapping with Fluent API and I came up with a question on how I should do the mapping very much. For example, I have the classes below. public partial class Territories { public…
-
3
votes1
answer811
viewsHow to display 2 BD tables inside a Datagridview in the application?
I have an application developed C# using the project Windows Forms that displays the People Database Table in a list in the field DataGridView. However I need to show in DataGridView also the table…
-
3
votes1
answer64
viewsI need help to transform this SQL into a LINQ
I have the following SQL: select conferencia.tb_conferencia.con_codigo, con_pedido, count(coi_codigo) as countItens, count(distinct cic_conferencia_item) as countItensConferidos from…
-
3
votes1
answer699
viewsHow to use Viewmodel in MVC 5 C# with Entity Framework?
I’m trying to learn how to use the concept of Viewmodel, so I did a basic project, but I’m having difficulties. I have the following models: Person id guy document Physique id name surname document…
-
3
votes1
answer26
viewsError running Updade-Database command
When executing the command Update-Database Package Manager Console gets the following error: Value cannot be null. Parameter name: entitySet I have only one model in the project for now public class…
-
3
votes1
answer143
viewsHow to return independent accentuation search on Asp.Net MVC systems
I have a problem in a system in relation to the search that does not return result for accentuation reasons. I would like to know how to make the accent be ignored in the system ? Note the system is…
-
3
votes0
answers603
viewsError when instantiating Context with Entity Framework
I’m taking the Entity Framework to learn, but when I run my code, it returns the following error: System.Typeloadexception: 'Inheritance security rules were violated by type:…
-
3
votes1
answer58
viewsShow fields of an entity in a different View
I have an entity Academic who owns a Professor, I want in the View details of Academic the teacher responsible for it, i.e. Professor that belongs to that Academic. The code I’m already using is…
-
3
votes1
answer179
viewsMigrations, Updating a null field to not null
I am updating the phone field and CPF of my User entity that was allowing nulls to not nulls. follow the migration file public partial class Required_fild_users_cpf_phone : DbMigration { public…
-
3
votes2
answers155
viewsHow to make Where ands dynamically with Linq and Entity Framework?
How can I make the ands dynamically in the where using Linq and entityFramework? Thanks in advance for any help. return _dbContext.TbParceiro //Preciso fazer algo do tipo mas isso não funciona, não…
-
3
votes2
answers1207
viewsLeft Join with three or more lambda tables
I have the following consultation on SQL: select e.idEstado, e.txtNomeEstado, e.txtSiglaEstado, c.idCidade, c.txtNomeCidade, de.txtH1, de.txtTitulo, de.txtDescricaoEstado, de.txtDescription from…
-
3
votes3
answers436
viewserror saving or updating with Entityframework
I have the following method: using (var context = new ClassContexto(ClassMaster.conexao())) { using (DbContextTransaction tran = context.Database.BeginTransaction(IsolationLevel.ReadCommitted)) {…