Most voted "entity-framework-6" questions
It is a set of ADO . NET technologies that supports data-driven application development.
Learn more…371 questions
Sort by count of
-
1
votes1
answer804
viewsInclude Problem in Entity Framework
I have the classes: public class Estado { public int Id { get; set; } public string Nome { get; set; } public string Uf{ get; set; } public ICollection<Cidade> Cidade { get; set; } } public…
-
1
votes0
answers87
viewsWhat is Entityframework and how do you use it with C# and connection to Postgreesql and Mysql databases?
I’m programming a CRUD of ADO students with C# and Mysql, my algorithm teacher told me about the Entity, but I can’t find anything clear that makes the connection between the banks. Somebody explain…
-
1
votes2
answers1078
viewsSite works on localhost, but not on Uolhost (permissions?)
I created a standard site (those that already come pre-encoded from visual studio 2013), using Asp.net mvc technology with common authentication by individual accounts. On my localhost the site runs…
-
1
votes1
answer78
viewsEntity Framework 6 relationship
I have a class where I need to have two different relationships with the same table. public class Usuario { public int Naturalidade {set;get;} public int CidadeEndereco {set;get; } public class…
-
1
votes1
answer1395
viewsEntityframework type conversion error: Cannot convert a 'System.Collections.Generic.Hashset`1[]' object
I am getting this error while trying to record a new record of Atendimento. Cannot convert an object of type 'System.Collections.Generic.Hashset`1[Domain.Servicesinexus]' in type…
-
1
votes1
answer191
viewsProblem with select in table with relationship Many to Many
I have the following scenario: public class Pedido { [Key] public int Id { get; set; } public virtual ICollection<ProdutosPedido> ProdutosPedidos { get; set; } public DateTime CreateDate {…
-
1
votes1
answer99
viewsCode First One to Many
My setting: public class AlunoAvaliacao { public int AlunoAvaliacaoID { get; set; } public DateTime Inicio { get; set; } public DateTime? Fim { get; set; } public virtual int AvaliacaoID { get; set;…
-
1
votes3
answers220
viewsHow to enable single-model Cascade
By default EF6 is enabled to delete in Select models, until we use the following convention: modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>(); According to my searches it…
entity-framework-6asked 10 years, 2 months ago Rod 9,412 -
1
votes1
answer308
viewsEntity Framework does not update my database
I’m using EF6 And it turns out that when I use Update-Database it does not update my database. For example I have my model: public class Cliente { public int Id {get;set} public string Nome…
entity-framework-6asked 10 years, 1 month ago Rod 9,412 -
1
votes1
answer103
viewsASP.NET MVC How to Manipulate Table Users Using Code First
I’m studying MVC ASP.NET code first. I’m a beginner and I have a question probably basic. When starting a project, it already creates a basic application, including the table User. I happen to be…
-
1
votes1
answer39
viewsWhy do navigation properties need to be declared virtual?
I’m mapping a relationship 1 x N using a class POCO (Plain Old CLR Object) to be used with the Entity Framework 6. In this case, I own an entity Cart which has several Products: public class…
-
1
votes1
answer57
viewsHow to foreach in each select using EF6?
Follows the code: var list = new List<String>(); list.Add("Casa"); list.Add("Apartamento"); var connection = ctx.Table.Where(x => x.Tipo== list).ToList(); My database:…
-
1
votes0
answers154
viewsupdate-database command does not work in multiple contexts
I have two context in my project. I followed as the basis of this Article where it shows how to have 2 context in the same project. Each context is for separate seats, so are 2 ConnectionString…
-
1
votes1
answer469
viewsEntity Framework 6, many X many relationship and Scaffolding
I am conducting a college project and my knowledge in ASP.Net are not very deep. In my project I came across a relationship Mxm and I cannot usefully implement this situation. The relationship is as…
-
1
votes0
answers40
viewsWorking with Entity Framwork and Sql Express Database
I have an application with a database connection and need to create an installer that contains the database script for it to be installed together with the application or at some point…
-
1
votes1
answer381
viewsSeparate Context Asp.Net Identity and Application Context
I am creating a repository using the Entity Framework, and the need arose for my entities to communicate with the entity Identityuser of Identity, only that Identity is on a separate layer of my…
-
1
votes0
answers57
viewsQuery using Object with Entity Framework
I have a method that gets one object which may be both int as string, someone knows a way to do the entity framework interpret the Object!? I know I can make one if and do the verification, but I’m…
-
1
votes1
answer113
viewsRelationship in table with Include does not work
I can’t get my father table to include the dependent: var medicos = TabelaMedico.Include(m => m.Especialidade).ToList(); Displays the following error message: CS1660: Cannot Convert lambda…
-
1
votes0
answers149
viewsError generating Migration after changing a relationship
I’m having an error when changing a relationship Many to Many in the Entity framework I had 3 classes: Politics 1-n Politicabnormal n-1 Normative It turns out that I didn’t want to map this…
-
1
votes1
answer393
viewsHow to import log file into Asp.net mvc with Entity framework
I would like to ask a question and I do not know how to structure my need.. I need to import/export a file with records, and depending on each record will be a different table, with its references…
-
1
votes1
answer1626
viewsC# decimal field in the form
Simple question: I have a currency decimal field on my model. It happens that when I insert a decimal value in the form field, it arrives as integer in the Controller: Example: Value of KM Wheelset:…
-
1
votes1
answer55
viewsRollback Sqlserver recording two separate tables
Premise: I’m using Entityframework6 for data persistence in Sqlserver. In a certain period I need to record data on two different tables, but the second table is dependent on the first example. try{…
-
1
votes1
answer89
viewsHow to load only the ID attribute in Many-To-One Relationship in EF?
I have two relationships Many-To-One in this class (usuario and projeto): public Atividade() { Projeto = new Projeto(); StatusAtividade = EStatusAtividade.NaoIniciado; TipoAtividade =…
-
1
votes2
answers48
viewsEntity framework 6.2.0 + Find
Hello, I’m using a search method with Entity framework and oracle, and found a problem with dates. In my search I use the following logic: Find(x => x.Data_Intencao >= Periodo.Date, c =>…
-
1
votes1
answer32
viewsWhat are the errors in this code using EF6?
What are the errors or inappropriate practices in this code? static void Main(string[] args) { using (var db = new AccountingSystemContainer()) { var invHeader = db.InvoiceHeaderSet.Create(); var…
-
1
votes1
answer116
viewsEF6 and NPGSQL : Foreign key breach error
Good afternoon ! I’m new to ASP.NET and EF6. I used to develop in PHP. I created a project (ASP.NET MVC) using EF6 and NPGSQL. I got a little bit when creating relationships between two tables but…
-
1
votes2
answers473
viewsSync items in comboboxes at runtime
I’ve been trying to figure out how to synchronize a combobox with another one for some time. I’m looking to synchronize comboboxes at runtime. When the user selects a category in the combobox,…
-
1
votes2
answers411
viewsFluent API and Migration
I have the following scenario: public abstract class Pessoa { /* Propriedades do Pessoa*/ public Guid IdPessoa { get; set; } } public class Cliente : Pessoa { public Cliente() { IdPessoa =…
-
1
votes0
answers199
viewsNpgsql - Entity Framework 6 Problem
I am finding problems to use Postgresql together with Entity Framework 6. When trying to fetch data from my repository I get the following message: The context cannot be used while the model is…
-
1
votes1
answer41
viewsGive preference to results that have the parameter passed in the Entity Framework
I am trying to implement a data solution that displays first the values that have the parameter passed to then pass the other parameters. Example: In a product table has the following data:…
-
1
votes1
answer854
viewsList, virtual and Entity Framework
In all the examples I have found about Entity framework, always use ICollection for collections of objects. public partial class Standard { public Standard() { this.Students = new…
-
1
votes3
answers333
viewsProblem saving accent with Entity Framework and Postgresql
I need to migrate a system with SQLSERVER database to a Postgresql 9.3. I’ve never worked with Postgre before so I’m using Entity Framework 6 with model-first to make the process easier. The…
-
1
votes1
answer655
viewsMap relationships with Fluent API
I have three simple classes of city, state and country. I realized that simply declaring a property of the type Estado in class Cidade the foreign key is generated correctly. I would like to know…
-
1
votes1
answer131
viewsCustomer entity type is not part of the model for the current context
I’m trying to reproduce this example of Entityframework with default repository, as follows the link: https://msdn.microsoft.com/pt-br/library/dn630213.aspx But it is giving the error described in…
-
1
votes1
answer113
viewsEntity Framework 6: Removal method does not work
I’m trying to delete an object using the Repository Pattern, but the problem is that when calling the method for removal nothing happens, nor throws exception. Financeirocontroller.Cs: [HttpPost]…
-
1
votes1
answer451
viewsHow to define Generator (from Firebird) for an Entity framework 6 model field?
For example: I have the following table: TABLE_EXAMPLO ----------- ID NAME And the following Generator: TABLE_EXAMPLO_GEN How I would map the entity so that the Entity Framework can call Generator…
-
1
votes1
answer107
viewsEntity Framework does not convert Firebird INTEGER to C#long
I am doing some tests with Entity Framework mapping and migrating a database of a legacy system. Setting Where I have a table similar to that: TESTE -------------------------------------- ID INTEGER…
-
1
votes0
answers208
viewsAutomapper error in relationship
I have the following classes: public class ListaGrupo : EntidadeBase { public ListaGrupo() { Items = new List<ListaGrupoItem>(); } public int Id { get; set; } public string Nome { get; set; }…
-
1
votes1
answer688
viewsHow to set a string-like field to nullable in Code First?
I got the field descrPapel of the kind string and would like that field to be created as nullable, that is, to accept null when I was gonna do some Insert/update in records of this type of entity.…
-
1
votes1
answer50
viewsError loading CREATE page
I have two related methods. Patrimonio and Categoria: [Table("Patrimonios")] public class Patrimonio { [Key] public Guid PatrimonioId { get; set; } public Guid CategoriaId { get; set; } [Required]…
-
1
votes1
answer149
viewsReturn Collection of Products according to Category
I am unable to bring the list of products that has at least 1 related category. //Classe public class EventoConfiguracaoViewModel { public EventoConfiguracaoViewModel() { Menus = new…
-
1
votes1
answer386
viewsEntity Framework 6: Select Error
I’m having problems with Entity Framework 6 with Code First. The operations of "Select" give error and EF6 does not specify the exception, as shown below: Error message: An exception was triggered…
-
1
votes1
answer111
viewsMany Exclusion for Many Entity Framework
I’m having a big problem with a many to many deletion in Entity Framework 6. Below follows my three classes. Budget class. public class Orcamento { public int Id { get; set; } public int ClienteId {…
-
1
votes1
answer366
viewsError in running update-database Migration
I am trying to run the creation of my database, but I am getting this error below and am not understanding the reason: The type 'Client' cannot be Mapped as defined because it maps inherited…
-
1
votes0
answers61
viewsEntity Framework 6 return cast error
I have two entities that inherit from the same abstract class. public class Empresa : PessoaJuridica { private Empresa() { } public Empresa(string CNPJ, string RazaoSocial, Status Situacao, byte…
-
1
votes1
answer102
viewsUpgrade from many to many with EF 6
My problem is when I try to update an entity that has a child class that in turn has other children. The structure is this: public class Diagrama { [Key] public int Numero_Diagrama { get; set; }…
-
1
votes1
answer231
viewsHow can I convert datetime to data string?
Follows the code: var fullEntries = dbContext.tbl_EntryPoint .Join( dbContext.tbl_Title, combinedEntry => combinedEntry.entry.TID, title => title.TID, (combinedEntry, title) => new { UID =…
-
1
votes1
answer23
viewsRelationship 1:N using EF using Data Annotationion
I’m trying to map between these two classes, where in championship I have a list of all stages related to the championship Follows the classes, [Table("ETAPA")] public class Etapa { [Key] public int…
-
1
votes0
answers49
viewsTransaction with Entitiframework 6.1.3 and Postgressql does not work correctly
I’m trying to use Entityframework6.Npgsqlcom transaction, however I get an Exception when I call the Dbcontext.Usetransaction method and pass a transaction. Error message (Last Innerexception):…
asp.net-mvc postgresql entity-framework-6 asp.net-web-apiasked 7 years, 10 months ago Maicon Matsubara 11 -
1
votes1
answer276
viewsMany To Many Entity Framework Update
I’m having trouble at the time of updating with relationship Many to Many. I want the update method to update all itemEntity fields as well as vendors. For example I only put the description field…