What is Active Class?
Active Class is a strongly typed, object-oriented programming language (branch of C# .NET Framework) that allows developers to execute flow and transaction control statements on the Magentrix platform. The language syntax is similar to C#.NET and enables developers to add business logic to most system events and create entire new state-of-the-art mobile-optimized web applications.
Developing Active Classes
There are four types of Active Classes supported in Magentrix:
- Data/Model Classes
- Utility Classes
Data classes are meant as a way for a program to access data. They have properties and often a very limited number of methods implemented. The Magentrix platform auto-generates all models, and developers can create their own for passing data between the controllers and views.
Controller classes are derived from "AspxController". These classes provide you with amazing controlling power to handle incoming HTTP requests and return the most suitable responses.
Any public method on a Controller is considered an action which can be triggered via an HTTP request. Controller and Action names are directly matched with HTTP request paths. Controller classes by default provide an entry point action called "Index"; usually this action is used as the initial action for users to view data.
The example below shows how the HTTP request is mapped to Controller actions. In this example, the Active Page name is "Order" and Controller name is "OrderController".
public class OrderController : AspxController
// GET -- /aspx/order OR /aspx/order/index
public override ActionResponse Index()
//GET -- /aspx/order/detail/00100000000007I0001
public ActionResponse Detail(string id)
var model = Database.Retrieve(id);
//POST -- /aspx/order/create
public ActionResponse Create(Contact model)
Controller actions cannot be reached directly via "aspx" namespace. You must associate your Controller with an Active Page. When a request triggers an Active Page to load, the Magentrix engine routes the request to the Active Page's Controller and executes the proper action.
Active Pages and their associated Controllers are used to build new web-based applications with user-interfaces (views). Magentrix also allows you to reuse the same Controllers independent of the page whenever a user-interface is required, such as creating actions that are used for communication between software applications, integrations and data exchanges.
These classes mostly have "static" methods or helper methods that facilitate coding and encourage code reuse.
Triggers are a special type of Active Class which allow developers to hook to certain database events such as Insert, Update or Delete operations and take additional steps for ensuring data integrity, call out to other cloud applications, validations, transactional operations and more. Learn more about Magentrix Trigger
This section consists of:
- Custom Controllers
- File Storage
- Database Access