Extensions

Extensions

Extensions are a key concept of the NetQuarry platform. Extensions are libraries that receive events from the running application objects. For example, when a record in a page is changed, the Mapper representing that data fires update events (notifications) through all of the extensions configured (via metadata) on that object.

This is a powerful programming pattern that is extremely simple for application developers, even those unfamiliar with Microsoft .NET to quickly grasp and master.
To create an extension, the developer runs a wizard from the Studio that allows them to specify the name, location, language (C#, VB.NET), and which objects they want to attach the extension.

Some objects support the idea of “global” extensions (e.g. Mappers). A global extension is automatically attached to all objects of a particular class. This is particularly useful for functionality such as auditing and summary information handling.

Extensions must implement a known interface (NetQuarry.IExtension) or derive from a provided base class. For example, to build an extension that handles events on a Mapper (e.g. Update, Insert, Delete), the following code (generated via the extension wizard) provides the template.

To make extension implementation easier, NetQuarry provides TypedMappers and TypedExtensions based on TypedMappers. TypedMappers derive from mapper-specific base class generics (templates) generated by the platform. TypedExtensions use TypedMappers. TypedExtensions, using TypedMappers provide a type-safe way to manipulate mapper objects.

Handling business logic using this methodology is both simple and robust. Extensions can be reused across multiple objects, they can be debugged interactively using Visual Studio, and they hide the complexity of the infrastructure from the application developer allowing them to concentrate on the task of building business applications.