3
How can I read from my bank an attribute int
which in my system is a type attribute Enumeration
in the Repository Pattern
?
I took a class:
public class Status : Enumeration
{
public static readonly Status Active = new Status(0, "Active");
public static readonly Status Inactive = new Status(1, "Inactive");
public static readonly Status Removed = new Status(2, "Removed");
public Status()
{
}
private Status(int value, string displayName)
: base(value, displayName)
{
}
}
Right in class Bank
I put a type attribute Status
;
Time to read from the bank where my class Bank
and a table with an attribute Status
guy int
, but the attribute remains null
.
How can I fix this?
Just reinforcing what this reading code is?
– novic
Como posso ler do meu banco um atributo int que no meu sistema
, in your question has this, by chance in addition to this code has the code that retrieves the information contained in the bank ?– novic
I don’t understand what you mean by reading code. I use ADO.net with Dapperpository
– Dariel
Yes I have a Service class that calls the Getall method of Repository
– Dariel
@Daniel put this specific code of your question?
– novic
public Ienumerable<Bankviewmodel> Getall() { Return _mapper. Map<Ienumerable<Bankviewmodel>> (_bankRepository.Findall()); }
– Dariel
except that when I do the reading except the Mapper if I do _bankRepository.Findall() it no longer brings the Status, then I discarded the Mapper as a problem, I think the problem is that the Enum is of type class that inherits from Enumerable
– Dariel
Pass this package please Dapperpository, the right name?
– novic
Microorm.Dapper.Repositories downloaded from Noget
– Dariel
was reading the comments is
Enumerable
orEnumeration
???, because I thought it was something from Dapper, but I didn’t find anything. Although it doesn’t make much sense to use it like this– novic
How is the method for searching in the bank? Taking advantage, the bank contains the integer values?
– Randrade
@Randrade is the type
int
yes in the bank, the problem that should be used aEnum
, but, he wants to translate this into a class he inherits from aEnumeration
, uses Dapper Repository layer. It seems that this is not very valid and does not work seems.– novic
@Virgilionovic Accept I’m pretty sure it doesn’t accept. My doubt was just to know how you really are doing. The Github’s own package shows an example of how to do this. However, I would like to understand if he was doing something beyond what is in the question.
– Randrade