Initialization and pre-flight check of the AyaNova DB connection

Namespace: GZTW.AyaNova.BLL
Assembly: GZTW.AyaNova.BLL (in GZTW.AyaNova.BLL.dll) Version: 7.0.0.0 (7.0.0.0)

Syntax

C#
public static void Initialize()
Visual Basic
Public Shared Sub Initialize
Visual C++
public:
static void Initialize()

Examples

Initializing AyaNova business object library in preparation for logging in:
CopyC#
//The call to Initialize is always the first required in any 
   //Stand alone application working with AyaNova (not required for plugins), it initializes the database
   //connection and business object framework and confirms operations can 
   //take place

   //IMPORTANT: If you receive an exception when calling the Initialize method it is most likely
   //a connection string problem in your config.txt file causing the
   //database provider to throw a not found exception.  Or a problem with the configuration 
   //file itself like it's missing or not configured properly.

   //Remember that in the case of any exception using the AyaNova business object library
   //it is that exception's Inner exception which is most likely the actual error (if present)
   //because AyaNova objects are invoked through a factory method which wraps any actual exception
   //generated by the business object inside a TargeInvocationException

     try
     {
          GZTW.AyaNova.BLL.AyaBizUtils.Initialize();
     }
     catch (Exception ex)
     {
      //"crack" the exception to get to the innermost exception
       while (ex.InnerException != null)
          ex = ex.InnerException;

      MessageBox.Show(ex.Message);
      return;
     }


   //Once your application gets to this point right after Initialize without error
   //you can be assured that you have a clean configuration file and a connection 
   //to the database and are ready to log in

See Also