Sdl.Web.Mvc/Controllers/PageController.cs
/// <summary>
/// Enriches all the Region/Entity Models embedded in the given Page Model.
/// </summary>
/// <param name="model">The Page Model to enrich.</param>
/// <remarks>Used by <see cref="FormatDataAttribute"/> to get all embedded Models enriched without rendering any Views.</remarks>
Enriches all the Region/Entity Models embedded in the given Page Model.
Enriches all the Region / Entity Models embedded in the given Page Model .
internal void EnrichEmbeddedModels(PageModel model)
        {
            using (new Tracer(model))
            {
                if (model == null)
                {
                    return;
                }
                foreach (RegionModel region in model.Regions)
                {
                    for (int i = 0; i < region.Entities.Count; i++)
                    {
                        EntityModel entity = region.Entities[i];
                        if (entity?.MvcData == null)
                        {
                            continue;
                        }
                        EntityModel enrichedEntityModel;
                        try
                        {
                            enrichedEntityModel = EnrichEntityModel(entity);
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex);
                            enrichedEntityModel = new ExceptionEntity(ex);
                        }
                        region.Entities[i] = enrichedEntityModel;
                    }
                }
            }
        }
internal void EnrichEmbeddedModels ( PageModel model ) { using ( new Tracer ( model ) ) { if ( model == null ) { return ; } foreach ( RegionModel region in model . Regions ) { for ( int i = 0 ; i < region . Entities . Count ; i ++ ) { EntityModel entity = region . Entities [ i ] ; if ( entity ? . MvcData == null ) { continue ; } EntityModel enrichedEntityModel ; try { enrichedEntityModel = EnrichEntityModel ( entity ) ; } catch ( Exception ex ) { Log . Error ( ex ) ; enrichedEntityModel = new ExceptionEntity ( ex ) ; } region . Entities [ i ] = enrichedEntityModel ; } } } }
Enriches all the Region/Entity Models embedded in the given Page Model.
Enriches all the Region / Entity Models embedded in the given Page Model .
// NOTE: Currently not enriching the Region Model itself, because we don't support custom Region Controllers (yet). // If there is a problem enriching an Entity, we replace it with an ExceptionEntity which holds the error details and carry on.
model
PageModel
The Page Model to enrich.
The Page Model to enrich .
remarks
Used by  to get all embedded Models enriched without rendering any Views.
Used by to get all embedded Models enriched without rendering any Views .