예제 #1
0
/*-----------------------------------------------------*/

        public cDataProvider GetDataProvider(String aDataSourceKey)
        {
            if (mDataProvider == null)
            {
                mDataProvider = CreateDataProvider(aDataSourceKey);
            }

            return(mDataProvider);
        }
예제 #2
0
/*====================================================*/

//	public cDataProvider CreateDataProvider(String aDataSourceKey) {
//		XmlNode			aDataSourceNode,
//						aClassNode;
//		cDataProvider	aDataProvider;
//
//		aDataSourceNode = DataDefinitionDoc.DocElement.SelectSingleNode("DataSources/DataSource[@Key='" + aDataSourceKey +
//							"' and ReleaseBuild[@BuildKey='" + Appl.BuildKey + "']]");
//		aClassNode = aDataSourceNode.SelectSingleNode("Class");
//
//		Object[]	aArgs = {Appl};
//		aDataProvider = (cDataProvider)cReflection.InstantiateObjectFromXMLClassNode(aClassNode, aArgs);
//		aDataProvider.DataDefinitionDoc = DataDefinitionDoc;
//		return aDataProvider;
//	}

/*-----------------------------------------------------*/

/* extracts existing data provider from a hash table
 *      if data provider does not exists, creates a new one by calling SetDataProvider
 */
//	public cDataProvider GetDataProvider(String aDataSourceKey) {
//		cDataProvider	    aDataProvider;
//
//		if (DataProviderTable[aDataSourceKey] == null){
//			aDataProvider = CreateDataProvider(aDataSourceKey);
//			DataProviderTable.Add(aDataSourceKey, aDataProvider);
//		}
//		else
//			aDataProvider = (cDataProvider)DataProviderTable[aDataSourceKey];
//
//		return aDataProvider;
//	}

/*-----------------------------------------------------*/

/* close connections to the data source for all data providers
 *      in the Object Factory
 */
//	public  void DataSource_Close() {
//
//		cDataProvider aDataProvider;
//		foreach (Object aObj in DataProviderTable.Values) {
//			aDataProvider = (cDataProvider)aObj;
//			aDataProvider.DataSource_Close();
//		}
//
//	}
//
/*====================================================*/

        public cDataProvider CreateDataProvider(String aDataSourceKey)
        {
            XmlNode aDataSourceNode,
                    aClassNode;

            aDataSourceNode = DataDefinitionDoc.DocElement.SelectSingleNode("DataSources/DataSource[@Key='" + aDataSourceKey +
                                                                            "' and ReleaseBuild[@BuildKey='" + Appl.BuildKey + "']]");
            aClassNode = aDataSourceNode.SelectSingleNode("Class");

            Object[] aArgs = { Appl };
            mDataProvider = (cDataProvider)cReflection.InstantiateObjectFromXMLClassNode(aClassNode, aArgs);
            mDataProvider.DataDefinitionDoc = DataDefinitionDoc;

            XmlNode aArgumentNode;

            aArgumentNode = aClassNode.SelectSingleNode("Arguments/Argument");
            mDataProvider.CommandTimeout = cXMLDoc.AttributeToInt(aArgumentNode, "CommandTimeout", 0);

            return(mDataProvider);
        }