Click or drag to resize
Askia

Persistent Class

Helper methods to store persistent environment data.
It is important to note that persistent data is only kept in memory despite the name, restarting a process using AskiaCore would clear this data.
Inheritance Hierarchy
SystemObject
  AskiaCorePersistent

Namespace:  AskiaCore
Assembly:  AskiaCore (in AskiaCore.dll) Version: 6.0.0-build000000000000000000000000000000000000000001
Syntax
public static class Persistent

The Persistent type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberInterviewsPath
Full physical path to the /Interviews directory, where temporary interviews are persisted.
Public propertyStatic memberResourcesPath
Full physical path to the /Resources directory, where resources will be stored during interviews.
Public propertyStatic memberResourcesUrl
URL (relative) to the /Resources directory, used in web pages during interviews.
Top
Methods
  NameDescription
Public methodStatic memberCode exampleEndDatabaseConnection
Closes the connection of the main database used by AskiaCore
Public methodStatic memberCode exampleEndWebProdDatabaseConnection
Closes the webprod database connection
Public methodStatic memberCode exampleInitDatabaseConnection
Initializes the connection of the main database used by AskiaCore
Public methodStatic memberCode exampleInitWebProdDatabaseConnection
Initializes the connection to the webprod database
Top
Remarks
For .NET web project you may use the Global.asax to initialise the persistent settings
Examples

Management of the database connection in the Global.asax of the .NET web project

using AskiaCore;

namespace MyApp
{
    public class Global : HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            // Initialize the database connection string (Where the survey was stored)
            Persistent.InitDatabaseConnection("connectionstring", DatabaseTypes.PORTAL);
            // Initialize the /Resources folder Path and URL
            Persistent.ResourcesPath = "C:\\Inetpub\\wwwroot\\MyApp\\Resources\\";
            Persistent.ResourcesUrl = "/Resources/";
        }

        protected void Application_End(object sender, EventArgs e)
        {
            // Release the database connection
            Persistent.EndDatabaseConnection();
        }
    }
}
See Also