All interaction with the ManagingEnergy system occurs through an instance of the ManagingEnergy.ManagingEnergyAPI object. The constructor of ManagingEnergyAPI shown below requires, as a parameter, an instantiated implementation of an IManagingEnergyDataAdaptor with which the API may interact with the underlying data.
/// <summary> /// Constructor /// </summary> /// <param name="dataAdaptor">The underlying data adaptor</param> public ManagingEnergyAPI(Data.IManagingEnergyDataAdaptor dataAdaptor) {…} |
The API includes a class ManagingEnergy.Data.MSSQL.SQLAdaptor, which implements the IManagingEnergyDataAdaptor interface and works with the legacy Microsoft SQL databases used in the Microsoft Access based version of ManagingEnergy.
// Create an instance of the MSSQL implementation of the IManagingEnergyDataAdaptor ManagingEnergy.Data.IManagingEnergyDataAdaptor sqlDataAdaptor = new ManagingEnergy.Data.MSSQL.SqlAdaptor("Data Source=sqlserver;Integrated Security=True;");
// create an instance of the API ManagingEnergy.ManagingEnergyAPI api = new ManagingEnergy.ManagingEnergyAPI(sqlDataAdaptor); |
At this point the API instance may be used to work with ManagingEnergy objects, such as Portfolios, Facilities and Meters.