How to map an enumerator using Entitytypeconfiguration from Entity Framework 6?

Asked

Viewed 332 times

3

Good evening, I have my next class

public class Endereco {
    public string Bairro { get; set; }
    public string Cidade { get; set; }
    public EUF Estado { get; set; }
}

and my enumerator

public enum EUF {
    SP = 1,
    PR = 2,
    SC = 3
}

and my mapping class

public EnderecoConfig : EntityTypeConfiguration<Endereco> {
    public EnderecoConfig() {
        Property(x => x.Cidade);
    }
}

How to map this Enum using Entitytypeconfiguration?

I’m used to the FLUENT NHIBERNATE where we use CustomType<EUF>()

  • 1

    Must necessarily use EntityTypeConfiguration? Because you don’t have to. You can make it simpler.

  • 1

    I’m used to using Fluent API with nhibernate, I find more organized our mapping, in addition to not "dirty" the classes with numerous Annotations

1 answer

1


Well, after a few searches and all, I have the following answer:

Nothing, you don’t need to make any configuration.

Just use Property(x => x.Estado);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.