From: DataLayer D. L. <dat...@li...> - 2006-11-23 18:21:06
|
DataServices DataSourceManager: - data_sources modified to use a generic dictionary with string keys and DataSource values. - LoadDataSources static function to read configuration file and instanciate each DataSource and add it to data_sources. - New Static constructor calling LoadDataSources() DataSource: - New constructor to create a DataSource passing each connection parameter using separate variables. - New instance fields to store each connection parameter separately (username, password, host, port and database) - New abstract BuildConnectionString() to build a connection string based on connection parameters stored in DataSource instance fields (username, password, host, port and database) - New abstract DeconstructConnectionString() to extract connection parameters from connection_string instance field and save them on separate instance fields (username, password, host, port and database) - Call BuildConnectionString and DeconstructConnectionString on respective constructors. - Connection instance and property removed. No connection instance is mantained by DataSource. - GetType function removed to enforce DataSource abstraction and avoid DataSource modification on future provider additions. - TODO: Remove ConnectionStringBuilder()static function. This functionality is implemented by BuildConnectionString() - BeginTransaction() uses new connections for new transactions. - CreateCommand functions removed. There is no need of Command object. That functionality is delegated to Query object on DataLayer to keep DataSources a low-level layer. Only IDbCommands are used by this layer. - FillSchema() function now receives a DbDataAdapter instead of a Command containing that DbDataAdapter. Locks implemented to avoid concurrent DataTable modification on mult-threaded environments. A new FillSchema() overload to accept a select IDbCommand from which a DbDataAdapter will be created. - Fill() overloaded and changed with similar behavior to FillSchema(). - Update() similar changes to Fill and FillSchema with additional overload to accept an array of DataRow's - New ComparisonOperators and LogicalOperators enumerations. - New ParseComparisonOperator and ParseLogicalOperator virtual functions to parse those enum values to sql equivalent operators. - New ParseRowFilterValue function to parse a parameter value into a valid string to be used as filter on a DataView - CreateCommandBuilder function removed. Command building process is delegated to each provider DataSource implementation. - Open and Close functions removed. No connection is maintained on DataSource - New ConstructParameter() and DeconstructParameter() to let each DataSource implementation create the string parameter to be used with an IDbCommand. (Different characters are used to parse parameters. SQL: '@', MySQL: '?', PGSql: ':') - New LiteralDate() and LiteralString() abstract functions to let each DataSource provider specify literals for strings and dates. - New ColumnInfo struct to store metadata information related to a field. - New abstract function GetTableColumns to retrieve metadata information related to a table. - New abstract function ParseType to map equivalent specific provider data types with standardized DbType enumeration. - Each DataSource implementation was updated with new changes. - Added one resources file for each DataSource to store commands to retrieve metadata information and keep clean code. DataLayer - New DataBaseManager class to create DataBase's based on DataSource's maintained by DataSourceManager from DataServices layer. Each DataBase is stored on a dictionary with the same string key of the DataSource and a DataBase value. - New Table and Query Objects wich uses DataSource's services. - New IQueryComponent - New TableJoin, TableJoinCollection, WhereStatement and WhereStatementCollection classes used by Query class. All classes implement IQueryComponent interface. DataBase: - New Constructor to receive a DataSource to be used by DataBase. - New data_source field and DataSource property to store and expose the DataBase's DataSource. - All static functions are now instance functions. - New table_pool generic dictionary to keep a collection of Table objects mapped to DataTables stored on instantiated DataSet. - DataSet is now maintained as an instance field. Property also changed to instance scope. - New DataSource instance field to bind DataBase with related DataSource. All DataBase's operations are done trough this field. - Fill now accepts only a Query object which is used to execute and fill DataTable stored on DataBase. - Update now only accepts a table name to be updated and uses Table and Query services. - New GetTable function to retrieve a Table stored on table_pool if it has been created previously or creates a new one, stores it on the pool and returns it. TableAttribute - New DataSource property to specify the key name of table's DataSource. - New constructor to specify table name and DataSource's key. - New data_source field to store table's DataSource key. If it's not specified, Table is mapped to first configured DataSource. |