How to Configure DataAccess with ConnectionBuilder. How to Configure DataAccess with DataConfigs.
The SQLManager class methods accept DataObjects and parts of a DbRequest message. It then creates the SQL statements for the developer.
These DbRequest message parts are: KeyColumns (LJCNetCommon.DbColumns) - Used to create a simple "Where" clause. PropertyNames (List<string>()) - Modifies which columns appear in the SQL statement. Filters (LJCDBMessageLib.DbFilters) - Used to create more complex "Where" clauses. Joins (LJCDBMessageLib.DbJoins) - Used to create "Join" clauses. The SQLManager class is similar to DataManager except SQLManager is a Client/Server only object whereas DataManager can do remote message based data access. SQLManager data methods return a DataTable and DataManager data methods return a DbResult message object. See the Technical Documentation for more information.
using LJCDBClientLib; using LJCDBMessage; using LJCNetCommon; using System.Collections.Generic; using System.Data; // Selecting data with the SQLManager object. internal Province Retrieve(string connectionString, string providerName) { Province retValue; // Create the SQLManager. var sqlManager = new SQLManager(null, "Province", connectionString , providerName); // Identify the records and properties to be selected. var keyColumns = new DbColumns() { { "ID" , 1 } }; var propertyNames = new List() { { "Name" }, { "Description" }, { "Abbreviation" } }; // Perform the Select var dataTable = sqlManager.GetDataTable(keyColumns, propertyNames); // Assumes DataTable column names same as object property names. // Sets object values where DataTable column names match // the object property names and DataTable column row // values are not null. // If DataRow is not provided, first row is used if available. var converter = new ResultConverter<Province, Provinces>(); retValue = converter.CreateDataFromTable(dataTable); return retValue; }