Sdl.Web.Tridion/Providers/ModelService/DefaultModelServiceProvider.cs
/// <summary>
/// Get page model data object.
/// </summary>
Get page model data object.
Get page model data object .
public PageModelData GetPageModelData(string urlPath, ILocalization localization, bool addIncludes)
        {
            try
            {                                           
                PageModelRequest request = new PageModelRequest
                {
                    Path = urlPath,
                    CmUriScheme = localization.CmUriScheme,
                    PublicationId = int.Parse(localization.Id),
                    PageInclusion = addIncludes ? PageInclusion.INCLUDE : PageInclusion.EXCLUDE,
                    Binder = _binder
                };
                ModelServiceResponse<PageModelData> response = _modelServiceClient.PerformRequest<PageModelData>(request);
                if (response.Response != null) response.Response.SerializationHashCode = response.Hashcode;
                return response.Response;
            }
            catch (ModelServiceException e)
            {
                Log.Error("{0} returned an unexpected response for URL '{1}':\n{2} ", ModelServiceName, _modelServiceClient.ModelServiceBaseUri,
                   e.Message);
                throw new DxaException($"{ModelServiceName} returned an unexpected response.", e);
            }
            catch (ItemNotFoundException)
            {
                return null;
            }
        }
public PageModelData GetPageModelData ( string urlPath , ILocalization localization , bool addIncludes ) { try { PageModelRequest request = new PageModelRequest { Path = urlPath , CmUriScheme = localization . CmUriScheme , PublicationId = int . Parse ( localization . Id ) , PageInclusion = addIncludes ? PageInclusion . INCLUDE : PageInclusion . EXCLUDE , Binder = _binder } ; ModelServiceResponse < PageModelData > response = _modelServiceClient . PerformRequest < PageModelData > ( request ) ; if ( response . Response != null ) response . Response . SerializationHashCode = response . Hashcode ; return response . Response ; } catch ( ModelServiceException e ) { Log . Error ( " \n " , ModelServiceName , _modelServiceClient . ModelServiceBaseUri , e . Message ) ; throw new DxaException ( $" { ModelServiceName }  returned an unexpected response. " , e ) ; } catch ( ItemNotFoundException ) { return null ; } }
Get page model data object.
Get page model data object .
urlPath
string
localization
ILocalization
addIncludes
bool