1
I am using Entityframeworkcore 3.0 together with Stored Procedure. The Procedure sp_login returns the following data:
cod_us A B C D E
111342 1 1 1 0 0
111342 1 2 1 1 1
111342 1 3 1 1 1
Models:
public class Login
{
[Key]
[Column("cod_us")]
public int CodUs { get; private set; }
[Column("A")]
public int iA { get; private set; }
[ForeignKey("B")]
public ICollection<LoginPer> LoginPers { get; set; }
}
public class LoginPer
{
[Key]
[Column("B")]
public int iB { get; private set; }
[Column("C")]
public bool bC { get; private set; }
[Column("D")]
public bool bD { get; private set; }
[Column("E")]
public bool bE { get; private set; }
}
I want to map to a structure that looks like this:
{
"cod_us": 111342,
"A": 1,
"LoginPers": [
{"B": 1, "C": 1, "D": 0, "E": 0},
{"B": 2, "C": 1, "D": 1, "E": 1},
{"B": 3, "C": 1, "D": 1, "E": 1}
]
}
How would you do that?
Why do you need to map it? It’s not just the result you need?
– novic