Questions tagged as 'fluent-api'

3
answers

Questions about relationship and mapping with Fluent API for EF 6

Whenever I have a class with properties that are of the type of other classes, which at the database level represents a foreign key, will I always need the navigation properties? And see this example: Revenda -> ClienteRevenda ->...
asked by 19.03.2014 / 18:43
2
answers

Many to Many with Fluent API

I'm doing a mapping with Fluent API and a you doubt how I should do the mapping very much. For example, I have the classes below. public partial class Territories { public Territories() { this.Employees = new HashSet<Em...
asked by 15.08.2017 / 15:47
2
answers

View Mapping with Entity Framework

I'm wondering how to map a View created in Oracle Database 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", pemb.id_porto AS "ID Porto Embarque", pemb.ds...
asked by 08.02.2018 / 17:29
1
answer

Fluent Mapping or Data Annotations?

I was watching a video lesson on ASP.NET MVC, when I see the Fluent Mapping of the Entity Framework for the first time. Soon I came to doubt. Which of the two is best recommended? Fluent Mapping or Data Annotations ? I really liked...
asked by 30.09.2014 / 03:50
1
answer

One-To-Many relationship with explicit foreign key name

I'm performing a simple one-to-many mapping via Fluent API specifying which column is used in the mapping, but EF "ignores" the configuration and continues using the default . Mappings: public AtividadeMap() {...
asked by 16.07.2015 / 20:33
0
answers

Persist data in related tables (1 x N)

I have these 2 related classes, and the requested class has a Collection of "OrderItems" ... The Order class: public class PedidoDTO { public int pedidoID { get; set; } public int codigo { get; set; } public Date...
asked by 18.08.2018 / 22:16
1
answer

Configuration many to many code fast migration

Good afternoon! I have this many-to-many configuration in my project. public class Usuario { public Usuario() { this.LocalTrabalho = new HashSet<LocalAtendimento>(); } public virtual ICollection<LocalAtendim...
asked by 30.09.2017 / 17:37
2
answers

Fluent API and Migration

I have the following scenario: public abstract class Pessoa { /* Propriedades do Pessoa*/ public Guid IdPessoa { get; set; } } public class Cliente : Pessoa { public Cliente() { IdPessoa = Guid.NewGuid(); Endereco...
asked by 21.01.2016 / 22:35
1
answer

How to set a field of type string as nullable in Code First?

I have the field descrPapel of type string and would like this field to be created as nullable , that is, accept null when doing some insert / update entity type. using System; using System.Collections.Generic; usi...
asked by 25.11.2016 / 15:49
1
answer

1: N Fluent API Mapping Cascade

How to model a 1: N relationship, where 1 user can have multiple requests, and in this request we have reference to another entity ? Ex: public class Usuario { public int UsuarioId { get; set; } public string Name {get; set; }...
asked by 21.06.2016 / 23:21