Listener Performance Tweak

We have covered Listeners before (Extending MicroLite with custom Listeners) but it is worth mentioning that MicroLite uses them internally to manage object identifiers (for example using the IdentifierStrategy.Identity with MS SQL Server or IdentifierStrategy.AutoIncrement with SQLite).

There are a number of Listeners included in MicroLite and by default they are all loaded so that all functionality is implemented and the configuration is as simple as possible. It is easy however, to control which listeners are loaded. By doing so, you reduce the number of actions invoked in the session pipeline.

In your application startup (before calling Configure...) simply clear the listeners collection and add the listeners you want to run. This can be a combination of listeners provided by MicroLite and any custom listeners you wish to use.

using MicroLite.Listeners;

Listener.Listeners.Clear(); // Clear all default IListeners.
Listener.Listeners.Add<IdentityListener>(); // Just add the IListeners you use.
...

Configure.Extensions()...

Configure.Fluently()...

You can use this from MicroLite 1.2 onwards.

The list of MicroLite supplied Listeners is available here and will be maintained as other listeners are added.

Advertisements

One thought on “Listener Performance Tweak

  1. Pingback: MicroLite 3.0 Enhancements | MicroLite ORM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s