Questions tagged as 'entity-framework'

2
answers

EF Relationship between 3 Tables

I'm learning Entity Framework using Code First and found a difficulty with relationships. I have three tables in the system that I'm doing: Flow (Key = FLOW_ID); Step (Key = STEP ID); Action (Key = ID_ACAO); I need two tables: one...
asked by 20.05.2014 / 19:11
2
answers

EF6 Code First Relationship between entities

I am trying to create a Condominium Data Model in ASP.NET with SQL Server. I stumbled upon the creation of the proprietario(1) relation with fracao(many) . The error returned is:    The INSERT statement conflicted with the FOR...
asked by 31.01.2014 / 13:14
2
answers

EntityFramework .AsEnumerable () or .ToList ()?

In one of the projects I got I saw the following code, which implements a data-listing method of a given entity, but this listing is read-only: /// <summary> /// Listar todas entidades /// </summary> /// <returns></returns...
asked by 03.08.2016 / 20:23
2
answers

Problem creating relationship with user class (IdentityUser) using IdentityFramework

When I create any relationship with my user class: namespace Modelo.Cadastro { public class Usuario : IdentityUser { [StringLength(250, ErrorMessage = "O nome de usuário deve conter no mínimo 3 caracteres", MinimumLength = 3)]...
asked by 25.07.2016 / 20:30
1
answer

Primary Key without Self-Increment for CPF in Entity Framework

The scenario is as follows: I have an Employee class. The primary key of it should be the employee's CPF that the user types. The problem: key follows a default auto increment, not going according to the entered CPF.    EX: I...
asked by 31.03.2016 / 01:41
1
answer

Query only Date in a DateTime field with LINQ

I'm generating a report in an app I'm developing, but with a little problem. When I send a query in a date range, I can not get anything because it is a DATETIME (I can not change to date only, because I need the time in some moments). So I'm ju...
asked by 09.10.2015 / 17:00
2
answers

Get null bank fields with LINQ

I have a Gestor table in the database where I store information for a user with Manager profile. In this table, I have two FK's : uniaoId and schoolId . Well, this manager MUST belong to a union and may or may not belong to a sch...
asked by 14.08.2015 / 14:27
1
answer

Table Relationship - EF

Good afternoon! I have the tables "Order of Service" and "Attachment". In my "Service Order" table, I want to be able to attach the scanned service order and be able to attach photos of the equipment. Order of service [Table("OrdemDeServ...
asked by 31.07.2015 / 20:27
4
answers

Updating data with entity framework

In the project I'm developing, MVC5, Entity 6, I just can not seem to update the data. The Code: zyon.TB_Cliente.Attach(cliente); zyon.Entry(cliente).State = System.Data.Entity.EntityState.Modified; zyon.SaveChanges(); That works when I...
asked by 27.11.2014 / 17:57
1
answer

How to return concrete classes, with filled navigation properties, through Linq queries?

Following this question: Query by Linq and Lambda getting range of options per sub-query. How do I get a closer result than simple? Where, however, my template grew to one more class (resulting in another table), the class Tela , I'm t...
asked by 23.10.2014 / 18:44