I have a class that contains a super object. When creating this class, it will contain one of the subobjects of the superobject. However, because the attributes of the subobjects are not in the superobject, I cannot access these attributes in Razor. Can someone tell me how I can reach the subobjects' attributes? I cannot put the subobjects' attributes in the superobject, because I'm going to convert the class to json and I cannot have all attributes visible in the json.
Class:
public class FoundPattern
{
public Pattern Pattern = new Pattern();
}
Superobject:
public class Pattern : OntologicalModel
{
}
Subobjects:
public class KpiPattern : Pattern
{
public List<KPI> KPIs = new List<KPI>();
}
.
public class ProcessPattern : Pattern
{
public List<Process> Processes = new List<Process>();
}
Razor page:
@model IEnumerable<FoundPattern>
@foreach (var x in item.SUBOBJECTNAME.SUBOBJECTATTRIBUTE)
{
// do something
}
Instead of SUBOBJECTNAME
and SUBOBJECTATTRIBUTE
I need the subobject and subobject attribute, respectively.