I recently learned a way to find code snippets quickly using sql. This is very helpful in scenarios when cross reference is turned off and you need to find places where a particular class or function is being called from.
On the model database on sql you can write the below query and you should be able to see all the methods where that code is called from.
On the model database on sql you can write the below query and you should be able to see all the methods where that code is called from.
SELECT RootHandle.Name
RootElementName,
ElementHandle.Name
ElementName,
ElementTypes.ElementTypeName
Type,
CAST(Sources.SourceText AS nvarchar(MAX))
SourceText
FROM Sources Sources (nolock)
JOIN ModelElement
ElementHandle (nolock)
ON Sources.SourceHandle
= ElementHandle.ElementHandle
JOIN ModelElement
RootHandle (nolock)
ON RootHandle.ElementHandle = ElementHandle.RootHandle
JOIN ElementTypes
ElementTypes (nolock)
ON ElementTypes.ElementType = ElementHandle.ElementType
WHERE CAST(Sources.SourceText AS nvarchar(MAX)) LIKE '%code to search for%'
OPTION(MAXDOP 0)
You can also join with the layer table to only see records from anything higher than syp layer
ReplyDeletejoin dbo.Layer layerT
on layert.Id = sources.LayerId
WHERE layerT.Id > 2