Metadata Search – Like A Pirate!

I’ve just shown you some examples for event handlers. Now I want to outline a way to find examples yourself. You surely could use the Metadata Search feature in Visual Studio but usually I prefer to do it in the folders that contain the xml files directly.

Let me use an example for this. Let’s assume we want to create a subscription to a datasource event OnActivated and need to see what can be done with it. Of course there are other implementations that – in most cases – should give us an idea of how this can be handled. So we copy the event handler

[FormDataSourceEventHandler(formDataSourceStr(PurchTable, PurchTable), FormDataSourceEventType::Activated)]
public static void PurchTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)

No matter which way you use for searching the metadata, the best search term to find other occurrences of OnActivated handles is going to be FormDataSourceEventType::Activated.

The tool I use for searching the xml files directly is Notepad++. The feature is called Find in Files and can be accessed via Shift + Ctrl + F or the task menu. If you want to find all standard implementations in Application Suite classes, you can search for FormDataSourceEventType::Activated in directory C:\Packages\ApplicationSuite\Foundation\AxClass (on-premise dev box).

Notepad++ Find In Files

Also there are some useful options like case matching and searching subdirectories etc.

And I guess there are many other tools that can do the same, this is just the one I like most 🙂

Since this is not only able to Find in Files but also to Find and Replace in Files there are some awesome (and possibly dangerous) additional options for changing things. Note: Changing the xml files using a text editor usually creates a pending change if you use version control – which is very good 🙂

The result of the search looks like the following; you need to switch back to VS and view the references there to analyze what standard does in those event subscriptions.

Notepad++ Found In Files

Leave a Comment