internal FdoFeatureReader(IFeatureReader reader) : base(reader) { _internalFactory = new FgfGeometryFactory(); _classDefinition = reader.GetClassDefinition(); _ptypes = new Dictionary <string, FdoPropertyType>(); _associations = new Dictionary <string, string>(); _ordinals = new Dictionary <string, int>(); _types = new Type[_classDefinition.Properties.Count]; _names = new string[_classDefinition.Properties.Count]; List <string> geoms = new List <string>(); for (int i = 0; i < _names.Length; i++) { PropertyDefinition pd = _classDefinition.Properties[i]; _names[i] = pd.Name; string name = _names[i]; _ordinals.Add(_names[i], i); DataPropertyDefinition dp = pd as DataPropertyDefinition; GeometricPropertyDefinition gp = pd as GeometricPropertyDefinition; if (dp != null) { _types[i] = ExpressUtility.GetClrTypeFromFdoDataType(dp.DataType); _ptypes[name] = ValueConverter.FromDataType(dp.DataType); } else if (gp != null) { _types[i] = typeof(byte[]); geoms.Add(gp.Name); _ptypes[name] = FdoPropertyType.Geometry; _associations[name] = gp.SpatialContextAssociation; } else if (pd.PropertyType == PropertyType.PropertyType_ObjectProperty) { _ptypes[name] = FdoPropertyType.Object; } else if (pd.PropertyType == PropertyType.PropertyType_RasterProperty) { _ptypes[name] = FdoPropertyType.Raster; _types[i] = typeof(IRaster); } else if (pd.PropertyType == PropertyType.PropertyType_AssociationProperty) { _ptypes[name] = FdoPropertyType.Association; } } _geometryNames = geoms.ToArray(); if (_classDefinition is FeatureClass && (_classDefinition as FeatureClass).GeometryProperty != null) { _defaultGeometryName = (_classDefinition as FeatureClass).GeometryProperty.Name; } else if (geoms.Count > 0) { _defaultGeometryName = geoms[0]; } }
internal FdoSqlReader(ISQLDataReader reader) { _internalReader = reader; _ordinals = new Dictionary <string, int>(); int count = reader.GetColumnCount(); _types = new Type[count]; _names = new string[count]; _ptypes = new Dictionary <string, FdoPropertyType>(); List <string> geoms = new List <string>(); for (int i = 0; i < count; i++) { string name = _internalReader.GetColumnName(i); _names[i] = name; _ordinals.Add(name, i); PropertyType ptype = _internalReader.GetPropertyType(name); if (ptype == PropertyType.PropertyType_DataProperty) { _types[i] = ExpressUtility.GetClrTypeFromFdoDataType(_internalReader.GetColumnType(name)); _ptypes[name] = ValueConverter.FromDataType(_internalReader.GetColumnType(name)); } else if (ptype == PropertyType.PropertyType_GeometricProperty) { _types[i] = typeof(byte[]); geoms.Add(name); _ptypes[name] = FdoPropertyType.Geometry; } else if (ptype == PropertyType.PropertyType_AssociationProperty) { _ptypes[name] = FdoPropertyType.Association; } else if (ptype == PropertyType.PropertyType_ObjectProperty) { _ptypes[name] = FdoPropertyType.Object; } else if (ptype == PropertyType.PropertyType_RasterProperty) { _ptypes[name] = FdoPropertyType.Raster; } } _geometryNames = geoms.ToArray(); if (geoms.Count > 0) { _defaultGeometryName = geoms[0]; } }