Пример #1
0
        private static ArrayList GetTypeMappingList(TypeDescriptor targetDescriptor, IMapDataSource dataSource)
        {
            ArrayList dataDescList = new ArrayList();

            if (dataSource != null)
            {
                for (int cnt = 0; cnt < dataSource.FieldCount; cnt++)
                {
                    string sourceColName = dataSource.GetFieldName(cnt);

                    PropertyDescriptor[] propDescList = null;

                    if ((dataSource is DataRowReader) || (dataSource is DataReaderSource) ||
                        ((dataSource is IMapDataSource) && ((IMapDataSource)dataSource).IsCollection()))
                    {
                        propDescList = targetDescriptor.GetOrdinalByDBColnName(sourceColName.ToUpper());
                    }
                    else
                    {
                        propDescList = targetDescriptor.GetOrdinalByPropName(sourceColName.ToUpper());
                    }


                    if (propDescList != null && propDescList.Length > 0)
                    {
                        foreach (PropertyDescriptor desc in propDescList)
                        {
                            DataDescriptor dataDesc = new DataDescriptor(sourceColName.ToUpper(), cnt, desc);

                            dataDescList.Add(dataDesc);
                        }
                    }
                }
            }

            return(dataDescList);
        }