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
answer328
viewsReturn Join Linq C#
I’m trying to return a Join to my class and it’s giving me the following error Error 1 Cannot implicitly convert type System.Collections.Generic.List in 'System.Collections.Generic.List' C:…
-
3
votes2
answers1498
viewsEntityframework, Migrations and Mysql. Schema name being misinterpreted. How to resolve?
I have a problem using Migrations with Mysql. When I try to create the first version with Migrations he’s making the schema/name of the bank part of the table name: public partial class Initial :…
-
3
votes2
answers684
viewsFiltering Kids Collection in Entity Framework with Lambda
I have a case where I need to bring all the items of the parent object where you have a certain condition, example: ctx.Pai .Where(x=> x.Ativo == true) .Include(Filhos)…
-
3
votes1
answer168
viewsMysql.Entity version compatible with Mysql 5.6
What versions of: Mysql.Data Mysql.Data.Entity EPH Compatible with Mysql version 5.6?
-
3
votes1
answer743
viewsHow to change a property during a LINQ query?
Is there any way to change in the LINQ query a property of the query itself? Ex.: I’m doing a consultation on a List<Cliente> and I want all customers whose NomeFantasia begin with * have the…
-
3
votes2
answers1101
viewsDistinct in the Plains does not work
I did this Illumination on my model: public static List<MontaArvoreAcao> CriarListaArvoreAcao() { RupturaEntities db = new RupturaEntities(); var _listaUnidade = ( from r in db.Ruptura join a…
-
3
votes1
answer1161
viewsPermission to create a database denied by the master database
I am trying to migrate the database created automatically by Identity to control user authentication and this error appears: CREATE DATABASE permission denied in database 'master'. My string…
asp.net-mvc sql-server entity-framework asp.net-identityasked 10 years, 1 month ago Sydinho Franco 103 -
3
votes3
answers339
viewsConnection to the bank is open in static method?
I have the following static class available for the entire application: public static class MinhaClasse { public static void Salvar(Item meuItem) { using (MeuEntities db = new MeuEntities()) {…
-
3
votes1
answer108
viewsProperty of a class that belongs to another context in the Entity Framework
I have a class called Locker that has the following property : public virtual ICollection<LockerReserve> Reserves { get; set; } The problem is that Lockerreserve belongs to a different context…
-
3
votes3
answers533
viewsHow to point the Entity framework to another database?
Hello, My Entity Framework always points to my local database...I have tried to change the string Connection by passing the data of a database that is on another server and nothing happens it keeps…
-
3
votes1
answer379
viewsPagination with generic method
I am trying to create a generic method for paging, I tried to do as the code below, but when using Skip I need to have a orderby and I’m not sure how to do. public IQueryable<TEntity>…
-
3
votes1
answer546
viewsWorking with high processing load in a table
What are the possible strategies of database modeling in a scenario where one has a specific table that receives a gigantic load of statements of insert, update and delete, in addition to high data…
-
3
votes1
answer677
viewsProblem storing decimal values in SQL Server
I have a decimal field (18, 3) and in the application I use a Javascript plugin to format the entered values, so I pass the value so SQL Server 45.000.000.000, when I look at what was registered was…
-
3
votes1
answer257
viewsInheritance with Repository Pattern
I’m studying and trying to implement the Repository Pattern in C# however I am having some difficulties in solving certain problems with inheritance among my classes of Repository, for example the…
c# oop entity-framework pattern-design inheritanceasked 9 years, 11 months ago Pablo Tondolo de Vargas 5,444 -
3
votes1
answer426
viewsHow to improve the performance of a foreach
I’m consuming a webservice, that has at least 5557 records. The problem is after consuming. I have to add in my database the records, and for that, I have to do a foreach, what ends up disturbing a…
-
3
votes1
answer1734
viewsHow to return dynamic list?
How to return a List<dynamic> in ASP.NET MVC 5 and Entityframework 6 For example I have an object with name User and mapped in my EDMX, when I do to bring the data dynamically like make an…
-
3
votes1
answer151
viewsIterations within Transactionscope
I have an Asp.Net MVC project with Entity Framework 5.0 in . Net Framework 4.0. What are the losses caused by a TransactionScope very long? I have the following code snippet: using(TransactionScope…
-
3
votes2
answers116
viewsHow to create a template with just a few table fields?
I have some tables with several fields. For example, the table (X) has some 20 fields of which I will only use 2 or 3. In this situation I have to create the templates with all fields and ignore the…
-
3
votes1
answer226
viewsHow to force an Exception when trying to delete a Master record that already contains relationship in a Child Record?
I created the following structure in SQL Server: Using Entityframework with Code-First the classes stayed that way: [Table("Master")] public class Master { [Key]…
c# sql-server entity-framework entity-framework-6 relationshipasked 9 years, 8 months ago Severo 299 -
3
votes2
answers468
viewsWhat is the corresponding timestamp variable type (SQL Server) in C#?
I have a field in the database (Seqalteracao) of type timestamp and need to map it to C# (Entity Framework). What is the corresponding type in C# for this type in the bank? public **Tipo**…
-
3
votes1
answer380
viewsHow to insert values into a relational table when inserting a Row and get this ID?
I am building a program to insert data from excel files into a database. My database has this structure: Tables (and fields): Schedule (Id (PK), Starttime, Endtime, Dayweek, Roomid (FK), Classid…
-
3
votes2
answers868
viewsHow does Entityframework’s Tracking / Chache work?
Every time I used the Entityframework in a project, to add a record in the database through it, of a class that contains class type members (usually on account of Foreignkeys), I would do this:…
-
3
votes1
answer2756
viewsWhat is an Associative Table?
Well, I see some examples of code using associative tables. But I’m not sure what this term means, its applicability, the concept etc... What is an associative table?
-
3
votes1
answer350
viewsEntity Framework: Data Model with column with the largest number of characters possible
I’m creating the tables with the Entity Framework, and I’m using the Data Annotation to determine the amount of characters, I wanted to know which larger size was supported for typing text and…
-
3
votes1
answer49
viewsName editing is confirmed in the database but does not happen in the listing
I am editing a column of the database and so far everything goes very well, but when I load the table that contains this column using Include, simply does not update the "Chauffeur", exchange the ID…
c# asp.net-mvc entity-framework linq lambda-expressionsasked 9 years, 5 months ago Luiz Negrini 1,424 -
3
votes1
answer78
viewsC# - Entityframework | Database Comparison
I started using EF a short time ago, so I don’t know much about it. I would like to know if I have how to make a comparison of my class with the database using EF. Example of comparison: Staff Class…
-
3
votes0
answers327
viewsEF mapping of Fluent API associative entity
I would like to know how to do a mapping without using ICollection, or may even be using, but would not want the bank to create a class, just to be able to connect the two classes. class Pessoa {…
-
3
votes1
answer176
viewsComplex mapping Entity Framework
I am creating a class structure that follows the following form: Department -Service A department provides various types of service. A specific service can only be provided by one department, not by…
-
3
votes2
answers400
viewsC# MVC5 - Insert Fields with 4 Decimal Digits
I am making an entry in the database (SQL Server 2008) of a field configured to 'decimal(10,4)', from which I try to insert/edit, by my application C# MVC5, a field of my model of type 'decimal''.…
-
3
votes1
answer245
viewsException when generating Controller with Entity Framework
In my application using Asp.net mvc, with Entity Framework 6, with Mysql, when trying to add the Controllers, with Views, using EPH, I have the following error: Settings of my web config.:…
asp.net-mvc asp.net-mvc-5 entity-framework entity-framework-6asked 9 years, 3 months ago Erico Souza 2,188 -
3
votes1
answer51
viewsConverts an SQL query into Entity Query
I asked this question in another forum, but the content of the discussion went another way so I decided to open this topic. Without running away from the subject, how do I perform this SQL query:…
-
3
votes1
answer915
viewsTest classes with dependencies (C# + Entity Framework)
I have a class "Sell" (summary of the class below) and in it I have a property "Orcamento". What would be the best way to do a unit test in this class? I came across 2 problems: Mock frameworks…
-
3
votes1
answer580
viewsPass Parameters to Store Procedure
Follow the Search Function Code public List<Pessoa> Buscar(string Nome) { using(var db = new MyContext()) { var Result = db.Database.SqlQuery<Pessoa>("EXEC SP_Busca_Cliente @Nome",…
-
3
votes2
answers86
viewsORM that can connect with 2 BD types (SQL or HANA)
Any suggestion of a ORM or Micro ORM that can connect/manipulate 2 different database types, not Imultaneos? The scenario: I already have an application that uses SQL, I need to adapt it to accept…
-
3
votes3
answers1160
viewsValidation to check if the record is being used before deleting
The MVC of my project is stuccoed in services, controllers, Views and models. My deletion screen works, but when the record is used in other tables it displays this error. The DELETE statement…
-
3
votes1
answer1291
viewsThe method or Operation is not implemented error
When I will add a record on my Include screen, I get this error. What can it be? Service public void AddItem(Test item) { var codigos = this.context.Tests.SingleOrDefault(x => x.Codigo ==…
-
3
votes3
answers455
viewsLINQ with JOIN and Where clause, how to do?
Good afternoon. I’m trying to make a left outer join (SQL) with LINQ, however, I’m not getting. The code of my class, is this one below. Can anyone give me a light on how I solve this? public class…
-
3
votes1
answer211
viewsWhen mapping class to viewModel, some data is lost
I have an appointment that returns a client and his phone, but when mapping the class to the viewModel, I lose phone data: consultation: public Cliente ObterClientePorId(Guid ClienteId) { var…
-
3
votes1
answer672
viewsDbupdateexception exception
I am trying to study EF with Code First. I am getting this exception on SaveChanges() An unhandled Exception of type System.Data.Entity.Infrastructure.Dbupdateexception occurred in…
-
3
votes1
answer312
viewsProblems with accentuation and Entity Framework
This is an excerpt from my research method at the bank: public dynamic GetAll(Func<TEntity, bool> predicate, int limit, ClassContexto contexto, int idEmpresa) { dynamic data = null; try { data…
-
3
votes1
answer455
viewsConsult in several fields of the record in a single query
I am developing an item list filter, and would like to filter by any term of the item record. I’ve seen this work in Angular, but I’m developing for ASP.NET MVC 5 and using the Entity Framework +…
-
3
votes1
answer1210
viewsQuery using the Entity framework
Within my repositorioEF I have the methods, in the method ExcluirRegistro I’m passing a StatusRegistro for the bank indicating that this record is being deleted, then in my methods ListarPorId and…
-
3
votes1
answer219
viewsRepeatless attribute (Unique) with Entity Framework?
I’m creating a model with two attributes that can’t be repeated, one GUID and a string. To make the string (is not the primary key - the primary key is the GUID) a field unique should I wear…
entity-frameworkasked 6 years, 8 months ago user62032 -
3
votes1
answer104
viewsOR in Join using Linq
I have the following tables: Tabela1 Tabela2 Tabela3 Tabela4 +----+-----------+ +----+-----------+------+------+ +----+-----------+------+------+ +----+-----------+ | Id | Descricao | | Id |…
-
3
votes1
answer124
viewsDisplay a button based on the action of another
I’m a beginner in Asp.net MVC I have a project. And within a certain view I have two buttons. However, one can only appear if the other is executed. 1 Button > Save (save car) 2 Button>…
-
3
votes1
answer65
viewsDoubt in a lambda expression returning "true"
When I do that: List<Tipo1> tipo = await context.MeuMetodo.Find(x => true).ToListAsync(); What am I saying here: (x => true)?
-
3
votes1
answer742
viewsEntity cannot be referenced by multiple instances
I’m trying to save the data in this method here... public ActionResult AtualizaInicioAtividade(Atividade atividadePre, Atividade atividadePrincipal) { try { using (CPMDatabaseEntities db = new…
-
3
votes2
answers419
viewsError creating data with foreign key
Hello, I am not able to insert data in a table that has foreign key, follow my model: 2 tables, Departamento and Funcionario, the official has the foreign key IdDepartamento. And I ran the…
-
3
votes2
answers721
viewsHtml.Editorfor value Default
How could you put Default value on a Html.EditorFor ? Understanding my code, I have a field that’s a filter when I click on EditorFor open the calendar, I’d like the datetime.now but only visual…
-
3
votes1
answer32
viewsMigration Conventions
I have an MVC DDD application that uses Sqlserver. I’m trying to get the database to Postgressql, but there is a FK duplicity error. For example, the default Sqlserver would be generated:…