Sdl.Web.Tridion/Providers/ModelService/DefaultModelServiceProvider.cs
/// <summary>
/// Get entity model data object.
/// </summary>
Get entity model data object.
Get entity model data object .
public EntityModelData GetEntityModelData(string entityId, ILocalization localization)
        {
            try
            {
                EntityModelRequest request = new EntityModelRequest
                {
                    EntityId = entityId,
                    CmUriScheme = localization.CmUriScheme,
                    PublicationId = int.Parse(localization.Id),
                    Binder = _binder                 
                };
                ModelServiceResponse<EntityModelData> response = _modelServiceClient.PerformRequest<EntityModelData>(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 EntityModelData GetEntityModelData ( string entityId , ILocalization localization ) { try { EntityModelRequest request = new EntityModelRequest { EntityId = entityId , CmUriScheme = localization . CmUriScheme , PublicationId = int . Parse ( localization . Id ) , Binder = _binder } ; ModelServiceResponse < EntityModelData > response = _modelServiceClient . PerformRequest < EntityModelData > ( 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 entity model data object.
Get entity model data object .
entityId
string
localization
ILocalization