mdo:net ( method, [ param-1, [ ,...n ] ] )
creates an instance of specified class and executes specified method.
- method is the string like assemblyName.className.methodName.
- assemblyName - the naem of assembly in DotNetNuke bin folder
- className - the name of the class to be instantiated. The class must be put in Mdo.XsltDb namespace.
- methodName is the name of metod to be called
- param-1, ... - parameters to be passed to the calling method. parametets can be of simple wellknown type (string, number, date, bool) or be an instance of a class.
mdo:net returns exactly the value that underlying method returns. So it can't return null since XSL extensions are not allowed to return nulls.
Developing classes to call from XSL
Create this simple class and compile it into MyAPI.dll
public class Welcomer
public string Hello(int PortalID, string name)
return "Hello, " + name;
And create an XsltDb module:
<xsl:value-of select="mdo:net('MyAPI.Welcomer.Hello', 'Alice')" />
What is important here:
- The class is put into the Mdo.XsltDb namespace. Caller must omit this part of class name since XsltDb adds it automatically This guarantees you that portal admin can't call any .NET class but only classes created to be used with
- The first parameter of hello method is PortalID. This parameter is automatically passed by XsltDb so you can reliably isolate portals from each other even if you let portal admins to create XSL themselves.
mdo:net doesn't provide direct access to static methods. But you can implement singleton and use shared instance.
Working with complex types
Parameters and return value can be of a simple type or class instance. If thay are simple values they can be both accessed within XSL code and .NET API. If your .NET function returns a class instance you can't access it directly within XSL but you can pass
it as a parameter to another .NET API or access it's members via