I'm building a Component that parse the appsettings that contains the sitemap and query to database to display the sidemenu.
I've bumped into a weird consistency error with the IOption pattern. It works fine on the first load but sometime the appsettings object is incomplete and my menu isn't rendered properly
I'm created a static class that fits my AppSettings. I registered it in the startup class. I don't think this is the issue since on first start the object is filled properly.
The component is called at each page load and rendered from the _Layout view
sitemap object successfully binded

After two page load, childrens are missing from one node

How is it possible that does value change ? The appsettings doesn't change at all
In case this is my model class
public class SiteMap
{
public List<SiteMapNode> Nodes { get; set; }
}
public class SiteMapNode
{
public string ResourceName { get; set; }
public string Href { get; set; }
public string Icon { get; set; }
public string Roles { get; set; }
public int PrestationCount { get; set; }
public List<SiteMapNode> Children { get; set; }
}
Here is the code that I think parse the appsettings on startup
builder.Services.Configure<SiteMap>(builder.Configuration.GetSection("SiteMap"));
Here is a part of my appsettings
{
...
"SiteMap": {
"nodes": [
{
"ResourceName": "Accueil",
"Href": "/",
"Icon": "fas fa-home",
"Roles": "*",
"Children": null
},
{
"ResourceName": "MonProfil",
"Href": "--dropdown",
"Icon": "flaticon2-user",
"Roles": "*",
"Children": [
{
"ResourceName": "Parametres",
"Href": "--dropdown",
"Icon": "flaticon2-settings",
"Roles": "*",
"Children": [
{
"ResourceName": "CorrigerAdresse",
"Href": "/account/address-error",
"Icon": "fas fa-map-marker-alt",
"Roles": "*",
"Children": null
},
{
"ResourceName": "AnnoncerDemenagement",
"Href": "/account/relocation",
"Icon": "fas fa-house-user",
"Roles": "*",
"Children": null
},
{
"ResourceName": "ChangementTitulaire",
"Href": "/account/ownership",
"Icon": "fas fa-user-edit",
"Roles": "*",
"Children": null
}
]
},
{
"ResourceName": "Factures",
"Href": "/invoices",
"Icon": "flaticon-layer",
"Roles": "*",
"Children": null
},
{
"ResourceName": "ModeFacturation",
"Href": "/account/billing",
"Icon": "fas fa-file-invoice-dollar",
"Roles": "*",
"Children": null
},
{
"ResourceName": "ChangerMotDePasse",
"Href": "/account/change-password",
"Icon": "fas fa-key",
"Roles": "*",
"Children": null
}
]
},
{
"ResourceName": "MesPrestations",
"Href": "--dropdown",
"Icon": "fas fa-box-open",
"Roles": "*",
"Children": [
{
"ResourceName": "TelephonieInternet",
"Href": "/prestation/voip",
"Icon": "flaticon2-phone",
"Roles": "*",
"Children": null
},
{
"ResourceName": "Mobile",
"Href": "/prestation/mobile",
"Icon": "fa fa-mobile",
"Roles": "*",
"Children": null
},
{
"ResourceName": "ConnexionInternet",
"Href": "/prestation/internet",
"Icon": "flaticon2-world",
"Roles": "*",
"Children": null
},
{
"ResourceName": "MyCanal",
"Href": "/prestation/tv",
"Icon": "fas fa-tv",
"Roles": "*",
"Children": null
}
]
},
{
"ResourceName": "Partenaire",
"Href": "--dropdown",
"Icon": "far fa-handshake",
"Roles": "partner",
"Children": [
{
"ResourceName": "Clients",
"Href": "/partner/clients",
"Icon": "flaticon-users-1",
"Roles": "partner",
"Children": null
},
{
"ResourceName": "StatistiquesParJour",
"Href": "/partner/daily-stats",
"Icon": "flaticon2-pie-chart-1",
"Roles": "partner",
"Children": null
},
{
"ResourceName": "StatistiquesParClient",
"Href": "/partner/client-stats",
"Icon": "fas fa-chart-bar",
"Roles": "partner",
"Children": null
},
{
"ResourceName": "Documentation",
"Href": "/partner/documentation",
"Icon": "flaticon2-open-text-book",
"Roles": "partner",
"Children": null
}
]
}
]
}
}
Does anyone got an idea or a simlar problem ?