Questions tagged as 'fluent-api'

1
answer

Doubt about mapping in the Entity Framework 6. Properties "readonly"

I have three tables in my bank: TB_COLABORATOR TB_JORNADA TB_JORNADA_COLABORADOR TB_JORNADA_COLABORADOR associates employees with the day and vice versa through the COD_JORNADA and COD_COLABORADOR fields. It also...
asked by 15.06.2015 / 15:33
2
answers

Fluent API with ASP.NET Identity

As this tutorial , I transported Identity in < in> class library to encapsulate the system business rule. However, the entire system is using the Fluent API to map the entities and Identity generates the tables through the code first . I...
asked by 13.02.2015 / 17:10
1
answer

How to map an image attribute by Fluent API?

I would like to know how to map an attribute of type image of SqlServer to the Fluent API. In my database I have the following table: CREATE TABLE [dbo].[ProdutoFotoERP]( [ProdutoFotoID] [int] NOT NULL, [Produt...
asked by 11.10.2016 / 18:54
1
answer

Problem saving a change using Entity Framework

I'm trying to persist a change I make in a registry, but I'm getting this error:    System.InvalidOperationException: 'A referential integrity constraint   violation occurred: The property value (s) of   'UnitMedida.UndMedidaId' on one end of...
asked by 31.05.2017 / 15:19
1
answer

Many to Many relationship problem in the Entity Framework

I have the following situation: To perform an authentication, I am using the old method for a small application, for assigning levels (roles), as many examples that have the web apart. I use EF and Postgres to access / write data and the Flue...
asked by 26.11.2015 / 17:52
1
answer

What is the need to inform the "Order" parameter in the object of type IndexAnnotation?

I am creating indexes for some columns that will be used in a query with Where() . The intention is to make the search faster. Until then I was creating like this: Property(x => x.Documento) .HasColumnAnnotation(IndexAnnot...
asked by 03.01.2017 / 14:15
2
answers

What is the cleanest and clearest way to validate entities using the Entity Framework

I'm using the Entity Framework for data manipulation. The project is divided into 2, one containing the domain entities and the other Fluent Api mappings). I need a clean and clear way to validate entities without polluting entities with Dat...
asked by 02.02.2017 / 00:00
2
answers

Fluent API relationship questions for EF 5

I have two classes: User > Contains your PK (ID). UsuarioP > Contains user ID (FK). Class User.cs public Usuario() { this.UsuariosP = new List<UsuarioP>(); } public int Id { get; set; } (...) public virtual ICo...
asked by 28.09.2015 / 15:21
1
answer

How to Configure Mapping Entity Framework 1: N Using Inheritance

I have two classes: Pessoa and Usuario . The Usuario class inherits the properties and methods of the Pessoa class. I'm using the Entity Framework and I believe you're doing the wrong mapping. So the problem is happ...
asked by 13.02.2017 / 15:57
3
answers

What is the difference between Data Annotations and Fluent API?

What's the difference between Data Annotations and Fluent API? Are there any restrictions between one or the other? Improve performance or are they just two ways to do the same?     
asked by 28.11.2016 / 20:07