Пример #1
0
        internal void CreateDataReaderFromObject(object dataSourceValue)
        {
            IEnumerable enumerable = dataSourceValue as IEnumerable;

            if (enumerable != null)
            {
                m_dataReader = new DataEnumerableReader(enumerable);
                return;
            }
            bool flag = false;

            if (dataSourceValue is Type)
            {
                try
                {
                    dataSourceValue = Activator.CreateInstance((Type)dataSourceValue);
                }
                catch
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                ArrayList arrayList = new ArrayList(1);
                arrayList.Add(dataSourceValue);
                m_dataReader = new DataEnumerableReader(arrayList);
            }
        }
Пример #2
0
 public DataSetProcessingExtension(IEnumerable dataSources, string dataSetName)
 {
     if (dataSources == null || dataSetName == null)
     {
         return;
     }
     m_dataSetName = dataSetName;
     foreach (IDataSource dataSource in dataSources)
     {
         if (dataSource.Name == dataSetName && dataSource.Value != null)
         {
             if (dataSource.Value is DataTable)
             {
                 m_dataReader = new DataTableReader((DataTable)dataSource.Value);
             }
             else
             {
                 CreateDataReaderFromObject(dataSource.Value);
             }
             break;
         }
     }
 }