0
I’m creating an application, using the DDD standard, so in my Presentation layer, I create viewModel, and in the controller I use the Mapper.Map<Entidade, EntidadeViewModel>
. i would like to know the following. in my domain, I use some Enuns, I need to create the Viewmodel of these Enuns? Actually, I did, but it didn’t work out.
Follow the Code Enum:
public enum EstadoViewModel
{
[Description("Rondônia")]
RO = 11,
[Description("Acre")]
AC = 12,
[Description("Amazonas")]
AM = 13,
[Description("Roraima")]
RR = 14,
[Description("Pará")]
PA = 15,
[Description("Amapá")]
AP = 16,
[Description("Tocantins")]
TO = 17,
[Description("Maranhão")]
MA = 21,
[Description("Piauí")]
PI = 22,
[Description("Ceará")]
CE = 23,
[Description("Rio Grande do Norte")]
RN = 24,
[Description("Paraíba")]
PB = 25,
[Description("Pernambuco")]
PE = 26,
[Description("Alagoas")]
AL = 27,
[Description("Sergipe")]
SE = 28,
[Description("Bahia")]
BA = 29,
[Description("Minas Gerais")]
MG = 31,
[Description("Espírito Santo")]
ES = 32,
[Description("Rio de Janeiro")]
RJ = 33,
[Description("São Paulo")]
SP = 35,
[Description("Paraná")]
PR = 41,
[Description("Santa Catarina")]
SC = 42,
[Description("Rio Grande do Sul")]
RS = 43,
[Description("Mato Grosso do Sul")]
MS = 50,
[Description("Mato Grosso")]
MT = 51,
[Description("Goiás")]
GO = 52,
[Description("Distrito Federal")]
DF = 53
}
That way you’re saving it in the bank on my chart that gets Enum, like 0. So, do I need to create the enumViewModel? or just use the Enum from the same domain layer? thus adding a reference in my Presentation layer to the domain layer.
I already solved.. I put the enums separately, and use them in any part of the proejto.. ie mine
ClienteDominio.Enum
has the same One as theClienteViewModel.Enum
. So far I had no problem using so. Thanks!!– Rafael Passos
Ball Show. Now that I’ve seen your post.
– Vainer Cesario