1

We are using the method GetRenderingParameters<T>() from Glass in many different places in our code. This method works correctly, it returns the rendering parameters as a strongly typed object.

Every time this method is called a SQL query like below is executed. The value of itemId in the query (all the way at the end) is always different and is always the Id of the object returned from the GetRenderingParameters method. The SQL query never returns any rows and seems unnecessary. Is there something that can be done so Glass does not execute this query every time? We are using Glass version 4.5.0.4.

exec sp_executesql N'
SELECT
  [ItemId],
  [Order],
  [Version],
  [Language],
  [Name],
  [Value],
  [FieldId],
  [MasterID],
  [ParentID],
  [Created]
FROM
( SELECT
    [Id] AS [ItemId],
    0 AS [Order],
    0 AS [Version],
    '''' AS [Language],
    [Name],
    '''' AS [Value],
    [TemplateID] AS [FieldId],
    [MasterID],
    [ParentID],
    [Created]
  FROM [Items]
  UNION ALL
  SELECT
    [ParentId] AS [ItemId],
    1 AS [Order],
    0 AS [Version],
    '''' AS [Language],
    NULL AS [Name],
    '''',
    NULL,
    NULL,
    [Id],
    NULL
  FROM [Items]
  UNION ALL
  SELECT
    [ItemId],
    2 AS [Order],
    0 AS [Version],
    '''' AS [Language],
    NULL AS [Name],
    [Value],
    [FieldId],
    NULL,
    NULL,
    NULL
  FROM [SharedFields]
  UNION ALL
  SELECT
    [ItemId],
    2 AS [Order],
    0 AS [Version],
    [Language],
    NULL AS [Name],
    [Value],
    [FieldId],
    NULL,
    NULL,
    NULL
  FROM [UnversionedFields]
  UNION ALL
  SELECT
    [ItemId],
    2 AS [Order],
    [Version],
    [Language],
    NULL AS [Name],
    [Value],
    [FieldId],
    NULL,
    NULL,
    NULL
  FROM [VersionedFields]) AS temp
  WHERE [ItemId] IN (SELECT [ID] FROM [Items] WITH (NOLOCK) WHERE [ID] = @itemId)
  ORDER BY [ItemId], [Order] ASC, [Language] DESC, [Version] DESC',N'@itemId uniqueidentifier',@itemId='D462DDA8-B2A5-482B-96F8-87B260D00F2B'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.