The loader interface provides a method for retrieving the SmallBusinessInstance, FormsFactory, and ReportEngine for a given database.
ISbaObjects GetSbaObjects(string configurationFile);
The method also has overloads that take a configuration-object or the database and server name. The calling application will call the loader to get the SBA objects like this:
ISbaObjects sbaObjects = loader.GetSbaObjects(configurationFile);
Where configurationFile is the full path to a valid sbc-file.
The SbaObjects class contains properties for the SmallBusinessInstance, FormsFactory, and ReportEngine. The reason this class exists is that it will abstract calling applications from the internal implementation of the SBA objects – for instance in order to use the SmallBusinessInstance a Logon method must be called and in order to use the FormsFactory a call to an Initialize method has to be made. These calls are made internally in the SbaObjects class and calling applications are abstracted from knowing about them.
The loader is not strongly bound to any version of SBA and returns the objects directly without type casting them. The calling application must type-check and cast the objects appropriately like this:
// Get the SmallBusinessInstance for this database
object smallBusinessInstance = sbaObjects.SmallBusinessInstance;
if (smallBusinessInstance is ISmallBusinessInstance)
// Do V1 stuff here
else if (smallBusinessInstance is ISmallBusinessInstanceV2)
// Do V2 stuff here
// Get FormsFactory for this database
object formsFactory = sbaObjects.FormsFactory;
if (formsFactory is IFormsFactory)
else if (formsFactory is IFormsFactoryV2)
IReportEngineV2 reportEngine = sbaObjects.ReportEngine as IReportEngineV2;
Note that the ReportEngine is a V2 feature – calling applications will need to handle the LoaderException that is thrown when trying to get this object for a database version that doesn’t support it – i.e. when trying to get a ReportEngine when connecting to a V1 database.