prior_thumb.jpg Sometimes you have an extension that you want to respond to events before all the others. Or may be you have two extensions that depend on each other and one should always fire before the other. It is not a common scenario, but I did run into it more then once and had to come up with less than perfect workarounds to resolve this. It would be nice to know in advance in what order extensions will respond to events, and now you can.

There is a new optional attribute you can set declaring an extension, "priority". It is an integer with default value of 999, and if you want your extension to handle event before others, set it to any number less the 999. If you have two competing extensions, just make sure their priorities are set in order you want them to fire and you are done. For example:

[Extension("ExtensionOne", "1.0", "", 100)]
    class ExtensionOne {...}

[Extension("ExtensionTwo", "1.0", "", 200)]
    class ExtensionTwo {...}

From this code, you can see that ExtensionOne (with priority of 100) will always respond to fired by BlogEngine events before ExtensionTwo (which has priority of 200) and they both will get in line before all the other extensions you have running on your site - if they don't pass priority as an attribute when declaring the extension.

You'll need a change set #24100 and up for this to work, it is tested in shared hosting environment running in medium trust.