There is no API for this. Inheritance information is not preserved after parsing configuration files.
In the Sitecore.Sites.ConfigSiteProvider
, here's the method that deals with site inheritance:
private void ResolveInheritance(SiteCollection sites, SafeDictionary<string, Site> siteDictionary)
{
foreach (Site site in (Collection<Site>) sites)
{
if (!string.IsNullOrEmpty(site.Properties["inherits"]))
{
this.AddInheritedProperties(site, siteDictionary);
}
}
}
And here's the decompiled code of AddInheritedProperties
:
private void AddInheritedProperties(Site site, SafeDictionary<string, Site> siteDictionary)
{
string index = site.Properties["inherits"];
Site site1 = siteDictionary[index];
Assert.IsNotNull((object) site1, "Could not find base site '{0}' for site '{1}'.", new object[2] { index, site.Name });
foreach (KeyValuePair<string, string> property in (SafeDictionary<string, string>) site1.Properties)
{
if (!site.Properties.ContainsKey(property.Key))
{
site.Properties[property.Key] = property.Value;
}
}
}
As you can see, it just copies all properties from the original site definition to the inherited one. Inheritance metadata is not preserved.
As a conclusion, if you need to know site inheritance in your code, you'll have to parse Sitecore configuration manually.