Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

public class LyniconConfig
{
  public static void RegisterModules() {}
  public static void InitialiseDataApi() {}
  public static void Initialise() {}
  public static void Shutdown() {}
}

LyniconConfig class contains the above four methods which are called at different stages of ASP.Net MVC startup in order to initialise Lynicon correctly.  Its very important that the correct sequence is observed in initialisation as certain stages depend on functions e.g. routing being set up properly by previous stages.  There follow templates for what these methods should contain.

public static void RegisterModules()
{
  LyniconModuleManager.Instance.RegisterModule(new CoreModule());
  LyniconModuleManager.Instance.RegisterModule(new ContentSchemaModule());

  // Register other modules here

  LyniconModuleManager.Instance.ValidateModules();
}

This method is used to activate and set up modules.  The two shown are pretty much essential.  Lynicon has a very powerful module API allowing for extension of its functions in a composable and controllable way.  The documentation contains a list of standard modules.

At the stage of RegisterModules, no routing has been set up: therefore we do not yet know what the content data types are, ContentTypeHierarchy has not yet been populated, and the Data API is not ready for use.

public static void InitialiseDataApi()
{
  Collator.RegisterExtensionType(typeof(MyUser));

  // Calls to Collator.SetupType and ContentTypeHierarchy.RegisterType here

  Collator.Instance.BuildRepository();
}

This method is used to put everything in place before building the composite types and activating the data API.  The example call toRegisterExtensionType is used to tell type composition to use the custom user type MyUser to extend the base User type.  Collator.SetupType can be used to indicate a type should use a persistence type other then Content (e.g. Basic).  Types which should be available via the data API, but which have no DataRoute set up for them as yet will need a call toContentTypeHierarchy.RegisterType to be made for them to be available via the Data API.

No routing has yet been set up here, and the Data API is not ready until the end of the method.

public static void Initialise()
{
  LyniconModuleManager.Instance.Initialise();

  // Initialise e.g. search here
}

The initialise method starts up all modules.  Note that the sequence in which this is done can be specified using sequencing constraints.  Routing has been initialised in this method and the Data API is fully available.

public static void Shutdown()
{
  LyniconModuleManager.Instance.Shutdown();
}

This method is called when the application shuts down, if you want to run any code at this time it can be entered here.

  • No labels