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
answer206
viewsArgument data type xml is invalid for argument 1 of Len Function
I am mapping a property to the xml database using Migrations. public string Xml { get; set; } this.Property(t => t.Xml).HasColumnName("Xml").HasColumnType("xml"); However, when consulting the…
-
1
votes1
answer717
viewsC# Entity Framework Invalid Object name 'sys.default_constraints'
In my C# MVC 5 project with Entity Framework together with an SQL Server, among a series of classes, I have a class called ctmdMandados.Cs: public class ctmdMandados { //cadastro dos mandados…
-
1
votes1
answer4974
viewsImplementation of ASP.NET MVC Shopping Cart
I am trying to set up a "simple" selling system, but I have no knowledge in e-commerce. What I want is the following: The user chooses the products he wants, assembles a cart, and finalizes the…
-
1
votes1
answer97
viewsENTITY FRAMEWORK - add-Migration New Project without renaming old tables
I want to share a database with some projects. I’ve already done the first project with the bank and it’s okay. I copied the project to create another similar one, changed the initial prefix of the…
c# asp.net-mvc entity-framework entity-framework-6 asp.net-mvc-4asked 9 years ago Daniel Gregatto 1,054 -
1
votes1
answer497
viewsChange Connectionstring only in Runtime memory
In the App.config of my application I encrypted the Connectionstring, now I need to decrypt in Runtime but not updating in the App.config file. I am using the following code, but the same ends up…
-
1
votes1
answer61
viewsHow do you convert this Sql to Entity framework?
I’m having difficulty passing this sql to the Entity Framework I’m using mvc 4. select pc.Nome, pc.Endereco, pc.Bairro, pc.Numero, pc.Telefone, pc.Email, ma.descricao from PontoDeColeta pc Inner…
-
1
votes2
answers7643
viewsApplication Security Change for Medium Trust
I recently uploaded a system I created in Asp.Net using MVC and Entity to the Kinghost web server. On localhost and on my own server it works normally. When trying to access the application on the…
-
1
votes2
answers640
viewsHow to return all records from a table
In my context I have a File table, and another version of the file, so I did with Entity to return a file, and only one version of the file: internal Arquivo GetArquivo(string termo) { using (var…
-
1
votes1
answer92
viewsMigrations error c# MVC
I created a Finance Drive Controller, but when I click on the menu to list returns the error: Invalid Object name 'dbo. Move'. Why did that name stick? It was supposed to be Movimentacoes. PS: I…
-
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
answer126
viewsFluent Mapping API 1:N cascateado
How to Model a Relationship of 1:N, where, 1 user may have several requests, and in this request we have reference to another entity? Ex: public class Usuario { public int UsuarioId { get; set; }…
-
1
votes3
answers897
viewsC# hangfire stopping
I’m using hangfire with IIS in an Asp.net MVC application with C#. I have a Task running every 5 minutes, but the application is stopping. This occurs in a variable time period, sometimes runs for 3…
-
1
votes1
answer469
viewsHow to configure Context to put table name in plural in en-BR?
I am in an ASP.net MVC 5 application, configuring a class DbContext. When the EF generates the database, the tables referring to the application objects are getting the names in the plural in…
-
1
votes1
answer109
viewsError updating model through database
Hello, I deleted a table in sql server, in visual studio 2015 I went to update the "update model from database" option, updated my change. But when saving EDMX all the entities(tables) of EDMX…
-
1
votes2
answers1110
viewsDisable Dropdownlist in View
Class public class ConfiguracaoEstado { .... [Required(ErrorMessage = "Selecione ao menos um estado.")] [Display(Name = "Estado")] public int EstadoID { get; set; } ... } Controller private void…
-
1
votes2
answers297
viewsDelete a data list in the EF
I have a method that deletes a version of a file according to the version of the file passed, 1 file may have many versions, and I wanted to delete all versions, I managed to delete only 1 version…
-
1
votes1
answer872
viewsHow do you popular a Treeview with a bank list?
I have a TreeView static representing folders and files in this template: <asp:TreeView ID="TreeView1" runat="server"> <Nodes> <asp:TreeNode Text="Diretorio1" Target="_blank">…
-
1
votes1
answer759
viewsHow to make a label receive a text from the database
Hello I know the question is very simple, but I’m having a difficulty, I have a radio button and I would like his text to be received from an SQL Server database through a SELECT. I’m using the…
-
1
votes1
answer53
viewsdoubt with Entity and limit
I need to retrieve the last 100 records from the bank, I’m using the code below, but it returns the first 100: dynamic data = null; try { data = limit == 0 ? (from p in contexto.Set<TEntity>()…
-
1
votes1
answer57
viewsRelation between entities returns null
I’m having difficulty checking a parameter in a relationship between Historico and Login. public class Historico { public int ID { get; set; } public virtual Login login{ get; set; } public DateTime…
-
1
votes1
answer364
viewsAn Object with the same key already exists in the Objectstatemanager. The Objectstatemanager cannot track Multiple Objects with the same key
Guys I’m having a bit of a problem, I’m trying to do an update using the Entity Framework, but when it arrives in Savechanges(), the following error appears. An Object with the same key already…
-
1
votes0
answers76
viewsCall EF entity by name and perform dynamic search
In applying Windowsform that I am developing, I intend to create only one form standard for listing the records that will be called through the system registration menu. That one form listing, and…
-
1
votes1
answer46
viewsCreating EF Designer from a database
By clicking NEXT it closes, when I use a bank sqlserver it works normally, but in this case I’m trying to mysql and I’m having this problem, I’ve made several modifications to plugins, reference and…
-
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
votes3
answers292
viewsEntity Framework 4 - Migrations error: The ... type is not defined in the <namespace> namespace. Map (Alias=Self)
I have a problem in mapping my application. [EDITED] Follows the Complete Datacontext Class: using System; using System.Collections.Generic; using System.Linq; using System.Web; using…
-
1
votes0
answers64
viewsHow to improve the loading of related entities using Linqkit?
Hi, I’m using Linqkit To stack "Expression Predicates", I need to do a "foreach" to load the related entities and this is being very expensive for application because to load 1000 records is taking…
-
1
votes1
answer285
viewsHow to use an Oracle database and Sql Server simultaneously with Entity Framework 6 in a single application?
I am developing an application where the information will be persisted in two databases, one MS SQL Server and one Oracle. I have no option to use both banks in the same DBMS, because the Oracle…
-
1
votes1
answer271
viewsWhat’s the difference between the two select?
Follows the code: Example: using (var ctx = new dbEntities()) { var resultado = ctx.Table.SqlQuery("Select * from Table WHERE id = 0 ").ToList<Table>(); } Other Example: private dbEntities db…
-
1
votes1
answer183
viewsUpdate problem with 1 field - EF
Follows the code: using (var db = new Entities()) { var t = new MinhaTabela { MeuCampo= 10 }; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); } Table definition: CREATE TABLE…
-
1
votes1
answer546
viewsProblem loading data with Entity Framework using Include
I’m using the Entity Framework with the Mysql on my system and I need to make a specific query that includes a list of a type of Model (ApplicationUser), in this list each returned object has in its…
c# mysql asp.net-mvc entity-framework lambda-expressionsasked 9 years, 10 months ago Luiz Negrini 1,424 -
1
votes1
answer336
views@Html.Dropdownlist returns null value
ASP.NET MVC4 I’m having a data return problem of a dropdownlist where the same list correctly values, but when choosing some value and post on the page the value arrives as null in the controller.…
-
1
votes1
answer112
viewsEntity Framework Error | not handled in user code
Hello, I need help in the following scenario. I have a class, where the field is Int64 in the backend and in SQL Server the field is bigint. ObjClasse.VariavelInteira = numInt; db.SaveChanges();…
entity-frameworkasked 8 years, 2 months ago Bruno Heringer 1,338 -
1
votes1
answer6563
viewsUnable to load file or Assembly 'Entityframework, Version=5.0.0.0 or one of its dependencies
I wonder if anyone could help me with this mistake because I’m trying to enable the Migrations in a project and this error appears when giving the command enable-Migrations in the visual studio…
-
1
votes0
answers256
viewsHow to use Postgresql with Entity Framework?
I have a system that I am developing in C# WPF using Postgresql as DBMS and wanted to use this same database for my application in ASP.NET MVC. You can make the Entity Framework have access to the…
-
1
votes1
answer125
viewsRelationship 1:N with RU
I have a table of units as below: public class Unity { public int Id {get;set } public string Name{ get; set; } } public class UsersRight { public int Id {get;set } public string Name{ get; set; }…
-
1
votes1
answer335
viewsWhy use MVVM in a WPF + EF + C#
I searched several forums and articles and all say that the MVVM standard should be used when working with an EF + WPF project. Can anyone tell me why that is? because I want to implement a system…
-
1
votes1
answer287
viewsHow to edit a Boolean field in a list in Asp.Net MVC
Guys, I’m developing an application that manages Courses, and I have the following problem. On my screen Administrator I need the fields Course Name, Student Name and the countryside Approved which…
-
1
votes1
answer51
viewsC# API - Update
I created an API using Entity Framework, the connection is ok, however, when I update the data in the database, qlqr one of the fields, Json in the API does not show the change. How to resolve this…
-
1
votes2
answers63
viewsHow do I get the usermanager property started in my Model
I wanted to form the field Name is automatically filled in by the username you are logged in to. How to include this property in mine Model? public class Condominio { public int CondominioId { get;…
-
1
votes2
answers231
viewsEF 6 Code First: Decimal field gives error when trying to save
You guys, good morning. I have a class that has a decimal field where I keep the price. So far so good. When it is displayed in the /Edit/ page, also ta beauty. But here’s the problem: 1 - The MVC…
c# asp.net-mvc entity-framework asp.net-mvc-4 code-firstasked 9 years, 9 months ago Luiz Felipe 456 -
1
votes2
answers858
viewsProblem to run "Update-Database"
I’m following the tutorial of this video to set up an ASP.NET MVC project using Entityframework6. The database used in the tutorial is Sqlserver and what I’m trying to use is Mysql. I already have…
-
1
votes0
answers274
viewsHow to import database tables to code with Entity Framework 6
In my project, I have only a few entities that are not connected to the database, but I run some procedures through EF6. These procs are only queries that bring data across information from more…
-
1
votes2
answers412
viewsError Saving EF Changes
Good night, When trying to insert data into table me error "An error occurred while updating the Entries. See the Inner Exception for Details.". var db = new Repositorio(); var perfilPessoaDB =…
-
1
votes1
answer87
viewsIs it really necessary to create a property that indicates the Foreign-key of a One-To-Many relation?
I would like to know if the information I found after searches, which briefly, is in the link below, proceeds:…
entity-frameworkasked 9 years, 8 months ago Joaquim Magalhães 169 -
1
votes1
answer49
viewsHow to make the Mapper module in EF?
How to make the Mapper module in Emptyframework 1 for n in two tables? Tabela 1 - clienteID - nome - endereçoID Tabela 2 - EndereçoID - rua - bairro - cidade…
entity-frameworkasked 7 years, 9 months ago Bruno H. 1,283 -
1
votes0
answers52
viewsKnockoutjs code to work after returning from Controller
I have an application that uses Knockoutjs, but when saved it returns some error the button that uses Knockutjs to and does not work, only after updating the page it comes back working properly,…
-
1
votes1
answer890
viewsCreate Database without Migration in Entity Framework Core
I am developing a study application in Entity Framework Core, and saw that through code-first it is possible to generate the database using the add-on commandMigration, but I wonder if there is any…
-
1
votes1
answer317
viewsPut the bug in my view
How do I play these messages in my view? Code that returns the message: public ActionResult SaveInternalAuditRecord(InternalAuditRecord criticalAnalysisRecord, string idResponsibles, string…
-
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
votes1
answer41
viewsIs it possible to instantiate a database connection manually using the Entity Framework?
I would like to manage my connections manually so that users can inform the server address, but Entity creates the connection string directly in the config file, the only way would be to change that…