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
-
2
votes2
answers75
viewsEntityframework recursive query triggering Exception
When performing the query with recursion an Exception is occurring: Equipe.RelatorioRH.Single(x => x.IdRodada == IdRodada) 'Entityframeworkdynamicproxies-Model' metadata is invalid. If you are…
-
2
votes1
answer686
viewsError: Object Reference not set to an instance of an Object
I’m having the following mistake: Object Reference not set to an instance of an Object Can anyone identify which error in my code? Follow my classes: Program: class Program { static void…
-
2
votes1
answer266
viewsDoubt with Entityframework (Migration)
I’m trying to make my code run, but I’m not getting it because of this Error Severity Code Description Project File Line Error CS0311 The type…
-
2
votes1
answer162
viewsWebmethod with Data Model
Good morning, I would like to receive a data model in a method of my webservice, what is the correct procedure for me to get ? I’m trying the code below but it’s not working. namespace UI.Web {…
-
2
votes1
answer194
viewsHow to insert entity with ID into Entity Framework
How to insert an entity with ID in Entity Framework 6.0? That is, insert with ID because the table does not generate it. For example: var last = _contexto.Area.AsEnumerable().LastOrDefault();…
-
2
votes1
answer1170
views"arithmetic Exception, Numeric overflow, or string truncation string right truncation" in search using LINQ
I have a table in a Firebird database CREATE TABLE CIDADE ( CID_CD SMALLINT NOT NULL, CID_DS CHAR(20) NOT NULL, CID_UF CHAR(2) NOT NULL, CID_DISTANCIA_SEDE SMALLINT NOT NULL, CID_CD_ALTERNATIVO…
-
2
votes1
answer160
viewsLEFT Outer Join does not work on LINQ when 0 is the reference? null only
I’m having doubts on Left Outer Join, I’m using MVC 5 C#, Net 4.5.2. I have the following Model Fornecedor public class fechamentoFornecedor { public int FornecedorId { get; set; } public int Tipo {…
-
2
votes1
answer65
viewsEntity Framework - Relationship Association Problem 1 to 0.. 1
I have a problem of association between two tables. Student and Student Tables. Public class Aluno { [Key] public int cod_aluno { get; set; } ........ public virtual Aluno_Unidade_Curso…
asp.net-mvc asp.net-mvc-5 entity-framework entity-framework-6asked 8 years, 9 months ago Rodolfo Araujo 23 -
2
votes2
answers9692
viewsEntity Framework Query with Inner Join and Where
I am making a query using Inner Join of some tables and a Where with only one condition, but the data is not returned in EF,the same query in Mysql works and returns data. Follows the code: string…
-
2
votes1
answer165
viewsEntity Framework, you doubt the solution structure (app.config and package.config)
I started a solution with Entity Framework code-first. In the solution structure, I separated the domains from the other EF files (context, etc.). That is, the domains were in a separate project.…
-
2
votes1
answer867
viewsUpdate multiple databases using code first without using console
Good afternoon, you guys. I have an application that each client has their database and I am using the code first. To update I am always running in hand the command update-database -force in the…
-
2
votes2
answers210
viewsEntity Framework 6: Provider Error
I am using EF6 Code First. While performing "Update-Database" the database is normally created. But when entering the data the following error is launched: No Entity Framework Provider found for the…
-
2
votes2
answers66
viewsInclude all child objects (navigation properies) in the Entity search
I wonder if it is possible to search the object completely filled without calling the include specifying each child object (with their respective children) of my class. Currently, I’m doing so:…
-
2
votes1
answer23
viewsEntity Framework - Lazyload with null-enabled property
What happens to a search that uses the include of Entity Framework on a property that can be null. var ocorrencia = db.Ocorrencia .Include("Pessoa") .FirstOrDefault(c => c.id == 3); That object…
-
2
votes1
answer75
viewsObject Type Declaration Doubt - Entity Framework
I need help in defining the correct class statement Follows my code: public void BuscaOcorremcias() { //Op 01 - Declarando um IList da Model IList<Ocorrencia> ocorrencias = null; //Op 02 -…
-
2
votes1
answer297
viewsEntity - Multiplicity Constraint violated
I don’t understand the reason for this error in Entity. Could you give me a help? Error: The role 'Occurrence_occurrence_target' of the Relationship 'Addresseb.Models.Occurrence_occurrence' has…
-
2
votes1
answer309
viewsEntity Framework - Error?
I’m following a tutorial from Entity framework: Simple Code First Example it is quite simple, but for some reason it is not working here and appears the error message is as follows: Aspnet Projects…
-
2
votes1
answer2607
viewsChange existing column to Identity
Having an entity where the first key is an integer and the same is defined not to be an Identity public class Teste { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get;…
-
2
votes3
answers3104
viewsError when adding Controler to ASP.NET MVC
Good morning, I am making a small solution using ASP.NET MVC with Entity Framework 6 to meet a work of my course. I believe the context class: namespace WillianRibeiro.EstudandoMVC.Web.Data{ public…
-
2
votes1
answer128
viewsError using Code First From Database
I’m trying to use the Entity Framework with a Sqlserver database that I created outside of Visual Studio. The problem is that when I add the ADO.NET Entity data Model to the project to do the…
-
2
votes1
answer468
viewsTransactionscope - Rollback problem
I need the Transactionscope do Rollback case any of these foreach error. I added a Exception manually between 2º and 3º foreach to test whether the rollback, but the information saved in the bank of…
-
2
votes1
answer379
viewsConvert SQL to LINQ
I have the following table CREATE TABLE `ultimaposicaorastreadores` ( `Id` CHAR(36) COLLATE utf8_bin NOT NULL DEFAULT '', `Serial` BIGINT(20) NOT NULL, `DataGps` DATETIME NOT NULL, PRIMARY KEY USING…
-
2
votes2
answers426
viewsView Mapping with Entity Framework
I am doubtful how to map a View created in Oracle Bank 11G with Fluent-API. Here is an excerpt from the view with alias: tran.id_transporte AS "ID Navio", tran.ds_nome_transporte AS "Navio",…
c# database entity-framework-6 fluent-apiasked 6 years, 11 months ago Samuel Renan Gonçalves Vaz 720 -
2
votes5
answers371
viewsValidate model before inserting in the database
I am developing a Webapi using Entityframework6. Before performing an INSERT in the database, I would like to validate the model that is coming via request (I believe to be fundamental), but I have…
-
2
votes2
answers682
viewsDoubt between using composite primary key or not in the associative table
I’m making a relationship where the same is N:N... Example: Projeto x Funcionario In this relationship I create an associative table called Projeto_Funcionario leading the id of the two classes.…
-
2
votes0
answers266
viewsHow to avoid Database Lock using Entityframework Transaction
I have a method where I save several classes and call another method to do an optimization on top of these classes, but I am using Transaction, in case something goes wrong in this optimization I…
-
2
votes1
answer97
viewsReturn the smallest value using the Entity Framework
I’m quite inexperienced, that’s true, but I’ve grown a pair and I’ve come here to ask.. I’ve been stuck for a few hours on a solution that apparently would have everything to be simple, but I can’t…
-
2
votes1
answer182
viewsEntity Framework Sum and Count different status
In my ASP.NET MVC project, I’m trying to achieve the equivalent of this SQL Server code: Select e.Numero, e.ValorEmprestimo, Count(Case when pvp.IdeStatus = false and pvp.DatVencimento >=…
c# asp.net-mvc asp.net entity-framework-6 entity-framework-coreasked 5 years, 6 months ago Pedro 186 -
2
votes1
answer132
viewsRelationship one-to-Many Entity Framework
I am developing a crud of registration for a project. When registering the user(Employee) must inform a IdCity that is related to the table cities(Cities). How is it possible for me to automatically…
c# asp.net-mvc .net entity-framework entity-framework-6asked 5 years, 5 months ago vinilazzari028 23 -
2
votes1
answer58
viewsMysql database coordinate persistence using Entity Framework
I’m having trouble making an efficient select for geolocation coordinates in Mysql. In the bank I am saving two values related to latitude and longitude, so when I perform the Select the two values…
-
2
votes1
answer203
viewsTernary relationship of entities in a relational scheme would be counter-normative, and how to do this mapping in Entity framework 6?
Taking as an example: We can abstract the relationship in several ways, one of them would be putting relation of N p/ N between project and skills needed, while another for employee and skills…
-
1
votes2
answers7317
viewsHow to create user with encryption password?
As I do in my ASP.Net MVC 5 and EF 6 application to save encrypted passwords in MD5 format when creating users?
-
1
votes1
answer154
viewsBank table does not update
I have in my database some tables they already contain data saved, but I am not able to update this data. I have the method below that performs the insertion of a new item in the table if the table…
-
1
votes1
answer131
viewsMigrations Entity framework method
Usually when working with the Entity framework, we use the calls in the console add-migration migrationName update-database I’d like to make it a method, so when you call him, he’ll be executed.…
entity-framework-6asked 10 years, 6 months ago Rod 9,412 -
1
votes1
answer999
viewsDbcontext: use other connection strings - Entityframework
I have a file web.config with 4 connection strings. How can I put these connection strings in the class DbContext? public DataContext():base("ConnectionString") // Essa é minha conexão padrão { }…
-
1
votes2
answers888
viewsError including sum of values in the footer of a gridview
I’m trying to include in the footnote of a gridview the sum of two columns, but I’m having difficulty creating the method that performs this function. I’ve already put the property ShowFooter as…
-
1
votes1
answer27
viewsEntity Framework removing entitdades that has fk
I have in my Repospository, my method of deleting public virtual void Deletar(int Id) { var entity = _dbSet.Find(Id); _dbSet.Remove(entity); } The problem is that it is deleting even if it is with…
entity-framework-6asked 10 years, 4 months ago Rod 9,412 -
1
votes1
answer437
viewsProblem to create database using Entityframework with configuration by Dbconfiguration
I’m studying the Entityframework, writing two contexts to understand how to handle it when my domain contains many classes of entity. Which would then be represented by many Dbset s in context,…
-
1
votes1
answer1041
viewsHow to create a Lambda expression with Group by and Order By
I’m having trouble creating a Lambda sentence with Group by and Order By Together. How to group by column Scope and Idescope, and sort by Idescope. Segue Sentença. public static List<Escopos>…
-
1
votes2
answers211
viewsGetting Foreign Key value - Object Reference not set to an instance of an Object
Using Code First - MVC 4 - EF6 I have the following Model: [Table("usuario")] public class Usuario { [Key] [Column("UsuarioId")] public int UsuarioId { get; set; } public string Nome { get; set; } }…
-
1
votes1
answer219
viewsMultitenancy application and structure
Saas applications are getting higher, reducing costs, maintenance, etc. We know we have the concept: Multitenancy (http://msdn.microsoft.com/en-us/library/aa479086.aspx) It’s them: By Column: Place…
-
1
votes1
answer50
viewsGlobal filters in Entity Framework
I would like all of mine DbSet filter all calls I mean, I’d like all the DbSet make the following filter: Where(x => x.active == true) No need for all the time I have to do dbo.Models.Where(x…
entity-framework-6asked 9 years, 11 months ago Rod 9,412 -
1
votes2
answers279
viewsSet name property anonymous object and Resources
I am using Resources for multi-language on a system. In a return json I create an anonymous object var resultado = minhalista.Select(x => new { }) But it turns out that I need the property of…
-
1
votes1
answer1355
viewsSystem.Argumentexception when using Mysql with Entity framework
I installed Mysql Connect in the environment, installed Mysql references through Nuget package. When I start the system and try to make an entry in the database, the following error appears: The…
-
1
votes1
answer64
viewsAutomated Deploy - Multi-customer version maintenance
How best to automate deploy ? Having 1 deploy for each client, what is the easiest way to maintain all these deploys ? Database Migrations and all version processing? In an example you have 100…
-
1
votes1
answer39
viewsLists do not load next to model
My model: public class Grupo: ModelBase { public Grupo() { this.Itens = new List<Item>(); } public Grupo(string nome): this() { this.Nome = nome; } public string Nome { get; set; } public…
-
1
votes1
answer363
viewsHow to re-create table in sql by Entityframework
I deleted a table directly in the database, performed the update-database command in Packmanager Console but the table was not created again. Which command should I use to recreate this table?…
entity-framework-6asked 9 years ago user38309 11 -
1
votes1
answer441
viewsDecimal value with 5 decimal places in sql server
I’m developing an application (Asp.NET MVC 5.2.3.0, EF 6.1.3 e SQL Server 2012), the database has a table with the field decimal(6, 5), when I save a value in this field -2,56478 for example in 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 8 years, 10 months ago Daniel Gregatto 1,054 -
1
votes1
answer233
viewsUpload _Layout.cshtml information from database
I want to upload the information to _Layout.cshtml as registered in the database, for example, @ViewBag.MetaDescription, @ViewBag.MetaKeywords, @ViewBag.Title and other information also from the…
asp.net-mvc asp.net-mvc-5 razor entity-framework-6asked 8 years, 9 months ago Alexandre Rodrigues Alves 11