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
-
0
votes1
answer123
views'Iorderedequeryable<Condominium>' does not contain a Definition for 'Tolistasync'
I’m getting the following error: as in the image below: In that part of the Code: public async Task<IEnumerable<Condominium>> FindCondominiumAllAsync() { return await FindAll()…
-
0
votes1
answer48
viewsProperty with GET (Getteronly) with Iqueryable C#
I don’t know exactly what it’s called when it maps the return in the method like this, but I’ll try to explain, I have the following class for example: public class Venda(){ public decimal Valor…
-
0
votes0
answers60
viewsLambda, add new item from the MVC 5 list
I have a model where a client has one or many Systems, and a System has one or many Customers: N:M I’m having a problem adding a new one SISTEMA, for my cliente My Model looks like this: public…
-
0
votes0
answers262
viewsEF Core - "A command is already in Progress"
I am requesting a Function in the database where it returns the values to be saved, but before saving I need to make a check if there is no same data, when I do this check with EF core it returns me…
c# asp.net entity-framework entity-framework-core asp-net-coreasked 5 years, 3 months ago iago soares 92 -
0
votes1
answer56
viewsRelationship 1:N in the Entity Framework
Good afternoon. I am studying the Entityframework and I am not managing to do something that seems to be simple but will not. ( I wanted to make a 1:N relationship between a table for a customer…
-
0
votes1
answer59
viewsProblem comparing 2 lists
I have a problem, I need to make a filter with a list of strings that comes as parameter with a icollection, the visual studio accuses "Cannot Convert from List to Unidadefederativaforedor" What…
-
0
votes0
answers47
viewsRemove(item) Not working Asp.Net Mvc
I have a method that uses remove to remove from the list. but not for sure, not from the error, and neither does it remove. first I go on the bench to get the object. var ctrl =…
-
0
votes1
answer187
viewsException released when deleting registry using Entity Framework Core. How to resolve?
When trying to delete registration of entities "Patients" and "Doctors" is returned an exception. The strange thing is that for the entity of "Schedules" everything happens normally. Follows the…
c# asp.net-mvc entity-framework entity-framework-core asp-net-coreasked 5 years, 2 months ago Ramon Almeida 382 -
0
votes1
answer82
viewsUpdate data with Entity Framework
I have a problem that when I have this code below: public static String GravarNoBDFildes(List<Fildes> dados) { try { Console.WriteLine("Começando o processamento"); var inseridos = new…
-
0
votes2
answers85
viewsPerformance between creating multiple objects or just one
I always had a question regarding the code blocks below, which would behave faster taking into account the service: foreach(var t in listaT) { using(TService service = new Tservice()) { t =…
-
0
votes1
answer59
viewsHow to use the . Sqlquery expression of EF in Efcore?
I’m refactoring a code and I’m having that doubt. public class MovimentoManualListRepository : RepositoryBase<MovimentoManualList>, IMovimentoManualListRepository { ConsultarContext _context;…
-
0
votes1
answer180
viewsAutomatic generation of Controllers and Views with . NET Entity Framework and Mysql
EDIT: I solved the problem below and others that appeared later. See my answer. I created a Business project using the Entity Framework (EF) Code First approach. I have a database in Mysql with 8…
-
0
votes1
answer36
viewsError deleting with Restapi and dot net core 3
Good afternoon, I am mounting an application with . net core 3 and Rest api, all my methods(get, put, post) work, but delete does not. Trying to delete generates the following error:…
-
0
votes0
answers124
viewsHow to set up Hangfire authentication in Production
I’m using Hangfire to manage background tasks, it works normally when I’m on localhost, but in the production environment I’m not being able to set up the authentication needed to open Dashboard I…
asp.net-mvc asp.net entity-framework asp-net-core hangfireasked 4 years, 11 months ago iago soares 92 -
0
votes0
answers53
viewsEntity Framework is not saving all information from the list
I have a problem that I cannot solve in any way with Entity Framework. In this scenario I am receiving information from the front, and then I need to save it in the database, however, when I have 2…
-
0
votes1
answer41
viewsEntity framework Client For Sale
I’m having doubts about how to build the relationship between the Client and Sale classes, taking a look at the microsoft website, I was left with doubt if the class should have the navigation for…
-
0
votes1
answer200
viewsForeign key breach error only in inclusion via API, via insertion bank is correct
I have a . NET Core API that connects to a Postgres database using Entity Framework. For each table that needs to do some insertion I have the model with the right fields (created by hand because I…
postgresql entity-framework asp.net-core sql-insert foreign-keyasked 4 years, 10 months ago Ianagos 71 -
0
votes1
answer39
viewschange webconfig mysql+ Connection. NET
I have this site using Entity framework running normally in mysql localhost database, now I want to put on a server, I have tried to change several times the conneciton string, but it gives two…
-
0
votes1
answer123
viewsPerform a Get that takes a List<long> ids as parameters
all right? I am doing a project in C# and at the moment I am doing the methods to be consumed via API Rest, my boss asked to do an Httpget that receives as parameter a List ids. I know that in my…
-
0
votes0
answers27
viewsEntity Framework - changing navigation property name generates schema validation error (edmx)
We have a . net system that uses Entity Framework 6 (database first). Some tables have more than one fk for another table. Entity, when generating navigation properties for these relationships,…
-
0
votes1
answer43
viewsI’m not getting to import a namespace that I created
Goodnight, I created a namespace called: Enums inside Models, when I try to import within a class the Enums, I’m not getting through... I’m with using Entity FrameWork with Asp.Net core MVC Folder…
-
0
votes0
answers31
viewsHow to load references before performing Insert?
I have a method that receives Id parameters. These are, referenced in a model, however, I need to be loaded your references before saved, because I need this information to communicate with a API…
-
0
votes1
answer54
viewsEntity Framework trying to insert duplicate record
I am starting an application in Blazor, using Entity Framework and Mysql database. Below I will detail the Tables, Models, Context and Method that is presenting me problem: Tables:…
-
0
votes1
answer233
viewsQuery user in Sql server
As I do to return instead of a query through a fixed user, the code was in the database to query the users and return it. I use Sql Server with aspnet core 3.1 application Someone who can help me in…
-
0
votes0
answers41
viewsShopping Cart Doesn’t Let You Add More Items After Cleaning It
I’m making a shopping cart for an E-commerce test on ASP.NET MVC, working with EF6. I was doing the logic, the cart it adds products and also removes. However, every time I add several products, and…
asp.net-mvc asp.net entity-framework asp.net-mvc-5 entity-framework-6asked 3 years, 11 months ago Leo 29 -
0
votes0
answers251
viewsValue cannot be null. Name of parameter: entitySet
I am trying to make a project of an e-commerce of Petshop in ASP.NET MVC with Entityframework. Everything was going well, until suddenly, when I tried to register or even list Vendor, this error…
asp.net-mvc entity-framework asp.net-mvc-5 visual-studio entity-framework-6asked 3 years, 12 months ago Leo 29 -
0
votes0
answers51
viewsHow to group a table by date in the C# and entityframework?
Next, I have this table : CREATE TABLE [dbo].[lcr_LogLastAccess] ( [Id] INT IDENTITY (1, 1) NOT NULL, [logl_Company] VARCHAR (100) NULL, [logl_Name] VARCHAR (100) NULL, [logl_Login] VARCHAR (100)…
-
0
votes0
answers12
viewsError retrieving Client Data for Editing - C#
Friends, I have a table "person" and "address", I can register a customer and insert their information in the two tables, but I’m having difficulty to consult the customer’s information and bring it…
-
0
votes1
answer38
viewsHow do I verify that an entity is tracked with Entity framework Core 2.0.3?
In my repository, I need to create a function that returns a "boolean" informing me if an Entity is being "Tracked". I need to do this, because when I do an "update" of the same entity more than…
-
0
votes0
answers47
viewsRemove seat seats on the database side with Asp.net core Entity Framework
I have a method that I receive a string, does the search and returns all the data that is equal to the word I passed, like this: public async Task<List<ProductDto>> GetAllAsync(string…
-
0
votes0
answers42
viewsEntity Framework: How to perform the Insert of a table with relation 1.. n without the children also being inserted?
I am using Dotnet Core 3.1 with EF Core. I have three classes in my context: public class Sale { public Sale() { this.Cars = new List<Car>(); this.CarSeller = new Seller(); } [Key] public int…
-
0
votes1
answer44
viewsI cannot connect to Database in Entity Framework
Good night, I am unable to connect to the database to create the Models folder tables in .NET. When I try to make the Migrations returns this error: "Could not run because the specified command or…
-
0
votes0
answers27
viewsConversion error in Where clause when filtering records using EF Core 2.0
I’m getting a list of records and filtering according to the given parameter. The problem is that an error is appearing in which I do not know (as picture). There are two classes : Personal Document…
-
0
votes1
answer41
viewsHow to filter a List record within another list c#
I have a class of App where in that class contains a ICollection<Comentarios> Now I need to filter ALL comments who have Status == Aprovado, where this Status is an Enum. I tried to do it this…
-
0
votes0
answers19
viewswrite data from a Datagridview to the database
Good morning, I am making an application similar to a sale, which contains sales and sales items. my problem is that I am not able to save the items of sale that is in datagridView, I am using…
-
0
votes1
answer60
viewsDefine Entity Account in dotnet
Hello, I have to define an Entity Account for a microservice of retail software. An Account can be the type: Individual Familia Enterprise Being the type individual is composed of the traditional…
-
-1
votes1
answer106
viewsDoubt in the construction of WS REST(Contract)
Gentlemen, I took an example in the book of john Sharp(microsoft press) to build a REST and came a simple doubt, but a doubt of good practices. He uses the Northwind BD. He creates a Class Library…
-
-1
votes1
answer246
viewsIs it feasible to use Mysql with Entity Framework 6 and get good CRUD performance?
It is feasible to use Mysql with Entity Framework 6 and get good CRUD performance?
-
-1
votes1
answer104
viewsForeach result behaves unexpected
I have been working on a page, where I need to create a treeview system with checkbox and this is consuming a lot of my time and leaves me worried about the project’s SLA. In the controller, there I…
-
-1
votes1
answer153
viewsDoubt Interface Asp.net mvc
Good night, I have a doubt, I chose to work with Generica interface and my doubt is: Every entity needs to have an interface inheriting from the Generica interface ? Ex: public interface…
-
-1
votes1
answer20
viewsHelp to convert SQL to LINQ
I want to convert the code select for a consultation LINQ SELECT bpac.cmp FROM bpac union SELECT bpai.cmp FROM bpai group by cmp order by cmp desc I’m trying to get the first table and I’m already…
-
-1
votes1
answer36
viewsInstance error
I’m getting the following error: Referência de objeto não definida para uma instância de um objeto. The line generating the error is as follows: var _TceView =…
-
-1
votes3
answers59
viewsConvert inside a lambda
I have a nullable int field and that within a lambda I need to popular a nonnullable property. If I do this: campo1 = Convert.ToInt32(campo2); I take this mistake: Notsupportedexception: LINQ to…
-
-1
votes1
answer108
viewsHow to get specific information from Tolistasync
I would like to create a system that prints on the Index page each Post equal to the image below And for this I created a method that searches the last 3 posts, however, I do not know how to print…
-
-1
votes1
answer56
viewsHow to update a User Entity that is converted into application?
Code: public int UpdateUser(User usr) { db.Users.Attach(usr.ToApplication()); db.Entry(usr.ToApplication()).State = System.Data.Entity.EntityState.Modified; return db.SaveChanges(); } Error:…
-
-1
votes1
answer578
viewsConnection String C# Entityframework
Would continue a project of work at home, the Connection String that works is as follows: <add name="DBModel" connectionString="data source=PD_22;initial catalog=EXERCICIO_ENTITY_JOSEEDUARDO;user…
-
-1
votes1
answer75
viewsError creating Entity framework
I’m having this problem trying to create the Entity Framework: Unable to generate the model because of the following Exception: System.Argumentexception: The argument 'name' cannot be null, Empty or…
entity-frameworkasked 8 years ago Pedro Vinicius 11 -
-1
votes2
answers96
viewsOnly allows 5 attempts at key duplication Entityframework? a 6 badge in Savechange()
Key duplication in write with Entityframework in competition with many users only allows 5 attempts and 6 badge in Savechange() (example 1). If it is with Sqlconnection it does not give any problem…
asp.net-mvc entity-framework vb.net entity-framework-6 competitionasked 7 years, 9 months ago DIT 9 -
-1
votes3
answers299
viewsHow to get the amount of "true"?
Follows code: int total_true = ctx .MinhaTabela .Where(x => x.id == 5) .Select(x => new Tabela_DTO { Campo1 = x.Campo1, // database está como true Campo2 = x.Campo2, //database está como false…
-
-1
votes1
answer54
viewsData is not being loaded in the Table
Good Afternoon, I wonder how I can get my list of records to be loaded into the table at the same time that the chart is loaded by AJAX, because currently in my model shows that there are records…