Questions tagged as 'entity-framework-6'

1
answer

Change existing column to Identity

Having an entity where the first key is an integer and is set to not be a Identity public class Teste { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; } public string Nome { get; set;...
asked by 07.08.2017 / 16:07
1
answer

Entity Framework - LazyLoad with property that allows null

What happens to a search that uses include of Entity Framework in a property that can be null. var ocorrencia = db.Ocorrencia .Include("Pessoa") .FirstOrDefault(c => c.id == 3); This ocorrencia...
asked by 22.03.2017 / 22:50
1
answer

Entity - Multiplicity constraint violated

I'm not understanding the reason for this error in Entity. Could you give me a help?    Error: The role 'OccurrenceHistorical_Target_Operation' of the relationship 'MoradaWeb.Models.Historical_Operation' has multiplicity 1 or 0..1. Mode...
asked by 29.03.2017 / 19:50
1
answer

Error using Code First From Database

I'm trying to use the Entity Framework with a SQLServer database that I created out of Visual Studio. The problem is that when I add the ADO.NET Entity data model in the project to make the relation, it is failing to create one of the classes to...
asked by 15.10.2017 / 20:49
1
answer

Entity Framework: Error creating bank

I'm using EF6 and I'm having a problem using the Update-Database -Verbose -Force command. It gives the following error: PM> Update-Database -Verbose -Force Using StartUp project 'PersonalTrainer.Presentation'. Using NuGet project 'P...
asked by 06.07.2016 / 18:04
1
answer

Entity Framework, doubts with the structure of the solution (app.config and package.config)

I started a solution with Entity Framework code-first. In the structure of the solution, I have separated the domains from the other EF files (context, etc.). That is, the domains were in a separate project. However, for me to be able to make us...
asked by 23.05.2016 / 23:43
1
answer

Entity Framework - Problem in relationship association 1 to 0..1

I'm having an association problem between two tables. Student and Student tables_Course_Unit. Public class Aluno { [Key] public int cod_aluno { get; set; } ........ public virtual Aluno_Unidade_Curso Aluno_Unidade_Curso { ge...
asked by 20.04.2016 / 22:41
1
answer

Update multiple database using code first without using console

Good afternoon, guys. I have an application that every client owns their database and I'm using code first. To update I'm always running the command update-database -force in the package console for each client database. Does anyone...
asked by 23.08.2016 / 21:26
1
answer

How to insert entity with ID in the 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(); area.Id = last !=null ? last.Id + 1 : 1; _contexto...
asked by 05.01.2016 / 20:34
1
answer

WebMethod with Data Model

Good morning, I would like to receive a data model in a method from my webservice, what is the correct procedure for me to get it? I'm trying the code below but it's not working. namespace UI.Web { [WebService(Namespace = "http://tempuri.o...
asked by 17.12.2015 / 14:14