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
votes1
answer88
viewsError when searching large amount of data in Entity framework,
I am putting together a report, and in it there is the option to consult by date period. When I consult with the interval of 30 or 60 days, I can obtain the data, where I group and return. However,…
-
1
votes2
answers452
viewsLINQ (LAMBDA) How do I add another list of objects to my Where? c#
Good afternoon, I’m running a C# Net Core application, using lambda for database context handling. I have one question, and that is: I have a list of objects with these two attributes: Name and…
-
1
votes1
answer177
viewsAsp Net Core MVC - Create Form with Multiple
It’s the first time I’ve asked a question, and I’m getting used to the page, so forgive me if I miss some rule. I’m new to Asp Net Core MVC and I’m picking up a lot to understand some things. The…
-
1
votes0
answers39
viewsUsing Union Select Entity Framework
I’m trying to use a Union select, in an Entity framework, but I’m not able to gather the information, follow how I’m trying to do: var un = _context.CaixaMovimentos.Select(c => new { c.Data,…
entity-frameworkasked 6 years, 4 months ago Mariana 2,512 -
1
votes1
answer110
viewsSystem.Data.Entity.Infrastructure.Dbupdateconcurrencyexception error while updating with Entity
Good morning. I need to do an update via Entity and it accuses me of the following error: System.Data.Entity.Infrastructure.DbUpdateConcurrencyException: 'Store update, insert, or delete statement…
-
1
votes1
answer82
viewsRelationship 1x1(or not)
I have 2 entities: Itempedido and Product... Using the Fluent API as I say to my Itempedido entity that she has a Product? Note: The product entity cannot have dependencies, although 1 product can…
c# entity-framework entity-framework-6 relationshipasked 6 years, 3 months ago Márcio Sebastião 769 -
1
votes0
answers168
viewsEntity Framework Conflicting changes to the role of the Relationship have been Detected
I have two objects that use a third in common and I have a problem in routine: 1) Creating a New Manufacturer var fab = new Fabricante(); DBSet.Add(fab) //Sem SaveChanges Then searching for the…
-
1
votes1
answer192
viewsHow to implement a Person repository function for the Generic - Asp.net MVC and EF Core repository
I have a function to return the highest value of a table ID field using EF Core. Only that I would like to implement it in my generic repository to be dynamic and to be used by all classes. How do I…
-
1
votes1
answer118
viewsMap a table and enable Auto-increment of a FK field in Postgre using EF Core and Fluent Api
I am unable to activate the Auto_increment of the Contactotype field in Postgre. In the table mapping I specified the "Valuegeneratedonadd" resource, but when I update the database with Migrations,…
entity-framework asp.net-core migrations fluent-api entity-framework-coreasked 6 years, 3 months ago Master JR 1,853 -
1
votes0
answers115
viewsJumping id 1000 Sql server 2014 (localDB)
In my application a few times when I will add some data to the database the ID jumps in 1000 drives. I found some solutions, but they are not good for me because I use EF6 with code-first and my…
-
1
votes1
answer56
viewsC# - EF Core doubts to create relational model
I am starting in Asp Net Core and have the following question: I own a model Curso and a model Unidade, a course has several units and that unit may belong to more than one course. I made the…
-
1
votes2
answers862
viewsNo parameterless constructor defined for this Object
I am trying to create a constructor with parameters as shown below: public class TestController : Controller { private readonly IAppService _servico; public DashboardController(IAppService servico)…
-
1
votes0
answers36
viewsCode-based configuration - EF6
I’ve been trying for a few days to implement a connection to an Oracle 11g database using the EF6 code-based configuration, but nothing I’ve done so far seems to work. Currently this is my…
-
1
votes1
answer119
viewsProblem in FK name size
I have a WebApi to work with a Firebird 2.5, I used the EF at the time, but today I am presenting the following error "The name 'FK_ARRUMACAO_CHECKLIST_ARRUMACAO_ARRUMACAO_ID' is longer than…
c# entity-framework entity-framework-6 firebirdasked 6 years, 2 months ago Lucas Riechelmann Ramos 521 -
1
votes2
answers80
viewsGenerate model-based Migration (Entity Framework)
I’m trying to generate a model-based Migration: [Key] public int Id { get; set; } [MaxLength(100)] public string NomeInstituicao_Fundamental { get; set; } public string AnoInicio_Fundamental { get;…
-
1
votes1
answer40
viewsDatabase First approach with Lazy Loading disabled?
I’m starting a project and the Sql Server already exists so I will take the approach Database First as an example of that article Entity Framework Tutorial. I’ll create the file .emdx and import the…
-
1
votes2
answers265
viewsToken Webapi C# Auth
I am issuing token, but at the moment make a request with the token, returns the following message: "Message": "Authorization has been denied for this request." I am passing user and static password…
-
1
votes2
answers1938
viewsGET service - System.Nullreferenceexception: 'Object Reference not set to an instance of an Object. '
I am acting in the creation of a service Get in ASP.NET Core, my project contains the following structure: Certidao.Data - Class Library Inside there is Dependences, Models: Sexo.cs and…
c# .net entity-framework asp.net-core nullpointerexceptionasked 6 years, 1 month ago Leandro Azevedo 303 -
1
votes1
answer99
viewsHow to create an extension method for the type of a class in VB.NET
I’m creating a MVC structure that will work similar to the Entity Framework within a VB.NET project where I created an attribute called TableAttribute which will define the table and the schemas to…
-
1
votes1
answer645
viewsCreate Dropdownlist with Viewbag
I’m getting the following error: Invalidoperationexception: There is no Viewdata item of type 'Ienumerable' that has the key 'Office'. Here I search from the database: public…
-
1
votes1
answer305
viewsEntity - Infinite loop in JSON conversion
What happens I’m having a problem using Entity with my application MVC. What happens is that when converting a class to JSON the program enters an infinite loop and ends up returning no-content…
-
1
votes1
answer44
viewsHelp with Linq Method using group by Dinâmico
I need to mount a dynamic graph from a filter panel and two fields select that can be crossed. I already have the structure that goes to the graph and how I need to return from backend. In the case…
-
1
votes0
answers70
viewsDoubt with LINQ to Entities
What would this query look like in LINQ to Entities: SELECT COUNT(cont) qtde_resp , pergunta , resposta FROM pesq_respostas WHERE id_pesquisa = 9 AND Tipo IN ('Intervalo', 'SimNao') GROUP BY…
c# sql entity-framework lambda-expressions linq-to-entitiesasked 5 years, 11 months ago alessandre martins 998 -
1
votes0
answers40
viewsdoubts with Entity Framework / SQL
I have the following script: when I execute it, I get the following answer: but when run by Entity Framework, the return is totally different, on all lines, the answer is the same, is it a bug? or…
entity-frameworkasked 5 years, 11 months ago alessandre martins 998 -
1
votes2
answers81
viewsError while searching with Entityframework
I’m having a problem with a request, in the controller when I query the products table appears the following message when debugging, I click on an icon and does not return any data, but the table…
-
1
votes1
answer41
viewsEF Core how to increment a list of already recorded objects
I am implementing a Web Api and I am using EF Core in the infrared layer. I have the related entities Table and Tableprecoitem, I wonder if to increment the property Tableprecoitem of an entity…
-
1
votes1
answer28
viewsGenerate a Partial Model from a complete Model
I have a Model called: Cliente_man that represents the customer register. But this Model, has a lot of information, and to the screen that I am developing not ah need of all, so I would like to move…
-
1
votes0
answers213
viewsAdd new values to an already filled Linq variable
I made that Lambda/Linq: var qry = _productRepository.Table.GroupJoin(_categoriesRepository.Table, p => p.CategoryId, c => c.Id, (p, c) => new { Product = p, Categories = c.DefaultIfEmpty()…
-
1
votes1
answer56
viewsIncludes in Entity Framework Core
Good afternoon, I have a problem to use Entity Framework Core, when I will do a query with includes as below: var protocolos = _protocoloService.Search(p => p.Active == true, p => p.Include(l…
-
1
votes1
answer164
viewsHow to make a Join in C#
Guys I’m having a question, I can make a SQL command (Ex.: select * from T_TABELA) in my C# repository like I do in the database, but I’d like to know if you can do a command join in the same C# I…
-
1
votes3
answers101
viewsOperator ?: does not work
I’m doing the union, in one of select i need to make a condition to appear in the correct way. To not keep appearing blank values. I tried to do it this way: Documento =…
-
1
votes1
answer459
viewsEntity Framework Migrations on an already installed system, how to run?
A C# Winforms application, with the Entity Framework that accesses data in SQL Server in development phase we use Migrations to make the database according to our model, but then with the system…
-
1
votes0
answers107
viewsHow to put one more condition in the Join on clause in a Linq/Lambda query
This query I run in the bank and is working as it should select rci.markuppercentual from resellercatalogitem rci join [Order] od on rci.ResellerCatalogId = od.ResellerCatalogId join OrderItem oi on…
-
1
votes2
answers49
viewsOptimization/correction in "Dbcontext.Savechanges()"
having regard to the following scenario:: using (TransactionScope scope = new TransactionScope()) { var allObjects = new List<MyObject>(); var objects = myStaticClass.GetAllObjects(); foreach…
-
1
votes1
answer50
viewsEntity Framework, code First, Database query
Good evening, I have two classes to which one is an attribute of the other, Customer has Anamnese , when I search the database the return is the right customer, but the field Anamnese is null, and I…
-
1
votes1
answer71
viewsError connecting to database (mysql) using entityFramework
When trying to connect in the database I get this message: The underlying Provider failed on Connectionstring. <entityFramework> <defaultConnectionFactory…
-
1
votes1
answer19
viewsHow and where to validate form controls that match the fields in my database?
I have the following problem: I need to validate my controls (textbox, combobox, etc) that correspond to the fields of my table, for example, on my screen I have the txtBairro control, in which the…
-
1
votes1
answer170
viewsOptimize query. The foreach is too slow
I have this query [Route("")] [HttpGet] [ResponseType(typeof(List<MarkupListResponse>))] public IHttpActionResult Get(int resellerId) { var catalogs =…
-
1
votes1
answer180
viewsMake Distinct Entity Framework
I’m trying to accomplish the Distinct, in my model of Phones, but none of the options I’m trying to make work. Could tell me what I’m doing wrong ? Below I described several ways I have tried to do,…
-
1
votes2
answers90
viewsProblem with database query by date using Line and Entity in C#
I have the following appointment at the bank; consultas = ctx.Consultas.Include(c => c.Cliente).Include(p => p.Procedimento).ToList(); which works perfectly, but I want to include a Where to…
-
1
votes1
answer30
viewsWhen defining which subpropriety in the EF mapping via Fluent API should be ignored, a Argumentexception is launched
I created a map on Entity Framework via Fluent API, however when defining that a subpropriety should be ignored the exception is thrown below: System.Argumentexception: 'The Expression 'x =>…
-
1
votes0
answers18
viewsProblem adding the Image Directory to the database using ASP.NET
Controller using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Uploadimagemvc.Models; using System.IO; namespace…
-
1
votes1
answer46
viewsWhat do you call the cast() function of the database in the ORDER method of a database in a LINQ expression in C# C#?
I have a field that stores DATETIME in my database. However I need to ignore the time of this field when I am ordering for it. The following code makes my search: public virtual async…
asp.net entity-framework linq linq-to-entities asp-net-coreasked 5 years, 6 months ago Daniel Silva 11 -
1
votes2
answers45
viewsPlan properties in a single table
Consider the following classes: public class Pessoa { public int Id { get; set; } public string Nome { get; set; } public Telefone Telefone { get; set; } } public class Telefone { public string…
-
1
votes1
answer74
viewsError while trying to update inside a foreach
I have this foreach private void UpdateAzureDiscountGroupReseller(IQueryable<Reseller> model) { Reseller resellerObj = new Reseller(); foreach (var item in model) {…
-
1
votes1
answer89
viewsAm I required to use a repeat loop if my LINQ query returns only one object?
My class: public class Carros { public int ID { get; private set; } public string Atributo2 { get; private set; } public int Atributo3 { get; private set; }}} Suppose the ID attribute could not…
-
1
votes1
answer147
viewsSubquery with entityframework lambda
I have this select which on the basis of it was made in the entity framework select PedidoVenda.Id, Funcionarios.Nome, FaturaContasReceber.FaturaContasReceberPId, FaturaContasReceberP.TotalFatura,…
-
1
votes1
answer299
viewsChange float field to decimal
I have a field, which in the model was like float, and that’s how you got saved, and you already have data in those columns. But what happens is that now I need 6 decimal places after the comma.…
-
1
votes1
answer206
viewsChanging Database of a system that is using EF code first
Please, I need to change the BD of an application using Mysql to use MS SQL Server. I have already migrated tables, data and relationships. The problem is that the system was made, I believe, in the…
-
1
votes1
answer44
viewsProblem in LINQ Query
In my job I need to return a list of a query LINQ. I have an expression that depending on some conditions she adds up Where to return this function. Follow the code: public HttpResponseMessage…