Questions tagged as 'entity-framework'

1
answer

Circular relationship with EntityFramework Core

I need to relate the Person with Person entity to the Person using the EF Core, but is giving the following error in Migrations:    "The navigation property 'PersonFilial' can not be added to the entity type 'PersonCadastro' because a propert...
asked by 21.12.2017 / 00:29
1
answer

Disable Lazy Loading for a specified query

I'm having a sloppy problem when it comes to fetching the data. I have 16 thousand records in the table that are taking about 6 seconds to be fetched. I noticed that while bringing these records this is also bringing the related records du...
asked by 28.09.2017 / 20:17
1
answer

CRUD Generic in Entity Framework with entity not specified

I'm trying to make a Generic CRUD for my project. However as I used DataBaseFirst I do not see how to have a generic class of Entity that can be inherited. Well it does not make the slightest sense, eventually when I upgrade the bank, it would h...
asked by 17.11.2017 / 13:07
1
answer

Get method with where customizable

I made WebAPI ( ASPNET with EF6 ) with support for Get() , Post() and Delete() verbs. At some point, I need to access certain values that are not returned by default by verbs, for example: The Request C...
asked by 12.03.2018 / 20:25
1
answer

Error: EntityTypeT has no key defined. Define the key for this EntityType

When I run my application, the following error is generated:    One or more validation errors were detected during model generation:   BolaoSCA.DataAccess.Context.InstallMap:: EntityType 'InvalidMap' has no key defined. Set the key for this E...
asked by 12.07.2017 / 03:44
2
answers

ASP.NET MVC Entity - Scaffolding for more than one table simultaneously

I've seen that an ASP.NET MVC project with C # has 2 magic tools that are EntityFramework and Scaffolding. With them it is possible in a few minutes to have all the registration features with in the database. Just bring the models with Entity an...
asked by 01.08.2017 / 19:50
1
answer

Create database without Migration in the Entity Framework Core

I am developing a study application in Entity Framework Core, and I saw that through code-first it is possible to generate the database using the add-migration command, but I would like to know if there is any way for the application to create t...
asked by 17.07.2017 / 23:19
1
answer

Error in my view

How do I play these messages in my view? Code that returns the messages: public ActionResult SaveInternalAuditRecord(InternalAuditRecord criticalAnalysisRecord, string idResponsibles, string idAuditors) { if (!ModelState.IsValid)...
asked by 19.07.2017 / 13:18
3
answers

Entity Framework 4 - Error Migrations: The type ... is not defined in namespace namespace.Map (Alias = Self)

I have a problem with my application mappings. [EDITED] Follow the complete DataContext Class: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; using System.Data.Entity.Mo...
asked by 05.12.2016 / 03:09
1
answer

What is the difference between the 2 select?

Follow the code: Example: using (var ctx = new dbEntities()) { var resultado = ctx.Table.SqlQuery("Select * from Table WHERE id = 0 ").ToList<Table>(); } Another example: privat...
asked by 07.01.2017 / 18:58