Questions tagged as 'fluent-api'

1
answer

Working with Enums of type CHAR, using C # and Entity Framework

I would like to know how to map my entity that uses an Enum of type char through the Entity Framework, using FluentApi. I have the following Enum: public enum Zona { Norte = 'N', Sul = 'S' } And my Entity: public class L...
asked by 09.06.2017 / 15:31
2
answers

EF 6, Mapping with Fluent Api in classes with inheritance

I am training the class mapping for the Entity Framework using the Fluent API and I have some questions. The first is this: Mapping a foreign key with attributes would look like this: public int EmpresaId {get; set;} [ForeignKey("EmpresaI...
asked by 19.03.2014 / 15:56
1
answer

How do I set default properties for a variable that start with a specific text?

Is there any way to set the properties of a variable by default to the initials of variables? Something like public string obsUsuario { get; set; } , all of which start with obs default to the IsOptional property, (or / and oth...
asked by 25.11.2016 / 17:11
2
answers

Persistence using Fluent API

How do I persist an address without having to pass all client information? Below is my address client mapping: HasMany(f => f.EnderecoList) .WithMany(e => e.ClienteList) .Map(me => {...
asked by 28.09.2015 / 18:13
1
answer

Map one-to-many entity with Fluent API

I have two classes, as an example below: public class Foo { public virtual int Chave {get; set;} public virtual List<Bar> Bar {get; set;} } public class Bar { public virtual int Chave {get; set;} public virtual Foo Foo...
asked by 12.10.2014 / 02:20
1
answer

Metadata Include - MVC - working with insertion of data into two tables

I have two classes: User UsuarioP where Usuario has its id (PK) and UsuarioP has id (FK) of Usuario . I'm working on ASP.NET MVC 4 using Fluent API. The classes are mapped inside the project t...
asked by 27.09.2015 / 22:50
1
answer

Fluent NxN Mapping of Classes with Compound Key

I have two classes that have composite primary keys, for example: Cliente : public class Cliente { public int EscritorioId { get; set; } public virtual Escritorio Escritorio { get; set; } public int Id { get; set; } }...
asked by 18.08.2015 / 21:00
1
answer

The method or operation is not implemented error

When I add a record to my Include screen, this error appears to me. What can it be? Service public void AddItem(Test item) { var codigos = this.context.Tests.SingleOrDefault(x => x.Codigo == item.Codigo);...
asked by 21.08.2015 / 15:19
1
answer

Migration Conventions

I have an MVC application in DDD that uses SQLServer. I'm looking to take the database to PostGresSQL, but an FK duplicity error occurs. For example, in the SqlServer pattern would be generated: FK_dbo.Adicao_dbo.OrgaoEmissorAtoLegal_ExT...
asked by 05.10.2018 / 21:19
0
answers

Associative entity EF mapping with Fluent API [closed]

I would like to know how to do a mapping without using ICollection , or it might even be using, but I would not want the bank to create a class, just to link the two classes. class Pessoa { public Guid IdPessoa { get; set; } public...
asked by 22.06.2015 / 17:24