Serialization error for spatial type
Serialization error for spatial type
On a system running .NET 4.5.2 we use Devart dotConnect for Oracle V8.5.616 together with the Entity Framework 6.0 and the NetTopologySuite V1.14.0.
After filling a DataSet using a DbDataAdapter with data of a table containing a column with the spatial data type DbGeography, I try to convert the data into XML using the DataSet's method GetXml. This operation fails with an InvalidOperationException indicating the default constructor is not defined for the class Devart.Data.Oracle.OracleObject.
Am I doing something wrong, or is this functionality not supported yet?
Thank you,
Joerg
StackTrace:
bei System.Xml.Serialization.TypeDesc.CheckSupported()
bei System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
bei System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean directReference)
bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
bei System.Xml.Serialization.XmlSerializerFactory.CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location, Evidence evidence)
bei System.Data.Common.ObjectStorage.GetXmlSerializer(Type type, XmlRootAttribute attribute)
bei System.Data.Common.SqlUdtStorage.ConvertObjectToXml(Object value, XmlWriter xmlWriter, XmlRootAttribute xmlAttrib)
bei System.Data.DataColumn.ConvertObjectToXml(Object value, XmlWriter xmlWriter, XmlRootAttribute xmlAttrib)
bei System.Data.XmlDataTreeWriter.XmlDataRowWriter(DataRow row, String encodedTableName)
bei System.Data.XmlDataTreeWriter.Save(XmlWriter xw, Boolean writeSchema)
bei System.Data.DataSet.GetXml()
After filling a DataSet using a DbDataAdapter with data of a table containing a column with the spatial data type DbGeography, I try to convert the data into XML using the DataSet's method GetXml. This operation fails with an InvalidOperationException indicating the default constructor is not defined for the class Devart.Data.Oracle.OracleObject.
Am I doing something wrong, or is this functionality not supported yet?
Thank you,
Joerg
StackTrace:
bei System.Xml.Serialization.TypeDesc.CheckSupported()
bei System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
bei System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean directReference)
bei System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
bei System.Xml.Serialization.XmlSerializerFactory.CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location, Evidence evidence)
bei System.Data.Common.ObjectStorage.GetXmlSerializer(Type type, XmlRootAttribute attribute)
bei System.Data.Common.SqlUdtStorage.ConvertObjectToXml(Object value, XmlWriter xmlWriter, XmlRootAttribute xmlAttrib)
bei System.Data.DataColumn.ConvertObjectToXml(Object value, XmlWriter xmlWriter, XmlRootAttribute xmlAttrib)
bei System.Data.XmlDataTreeWriter.XmlDataRowWriter(DataRow row, String encodedTableName)
bei System.Data.XmlDataTreeWriter.Save(XmlWriter xw, Boolean writeSchema)
bei System.Data.DataSet.GetXml()
Re: Serialization error for spatial type
Please use NTS Topology Suite v1.13.2. A similar question was discussed at http://forums.devart.com/viewtopic.php?t=30686.
We will notify you when NTS Topology Suite v1.14 is supported.
We will notify you when NTS Topology Suite v1.14 is supported.
Re: Serialization error for spatial type
Thank you for your response.
So we changed to NTS 1.13.2 and GeoAPI 1.7.2 - but it still throws the same exception...
Do you have any further advice?
So we changed to NTS 1.13.2 and GeoAPI 1.7.2 - but it still throws the same exception...
Do you have any further advice?
Re: Serialization error for spatial type
OracleObject could not be serialized because OracleObject depends on opened connection and cannot exist without it.
Re: Serialization error for spatial type
Is there a work-around for this?
How can I convert the result of a database SELECT which contains a spatial column into XML?
How can I convert the result of a database SELECT which contains a spatial column into XML?
Re: Serialization error for spatial type
Instead of
please use
For more information, refer to http://blog.devart.com/using-entity-fra ... rpmap.html.
Code: Select all
cmd.CommandText = "select id, geometry from cities";
Code: Select all
cmd.CommandText = "select id, (CASE WHEN Extent1.Geometry IS NULL THEN NULL ELSE 'SRID=' || NVL(Extent1.Geometry.SDO_SRID, '0') || ';' || SDO_UTIL.TO_WKTGEOMETRY(Extent1.Geometry) END) AS Geometry from cities Extent1";
Re: Serialization error for spatial type
Thank you for your answer and the provided SQL snippet. It is not what I expected, but at least I now have a work-around. Thank you again for your effort in supporting us.
Re: Serialization error for spatial type
dotConnect for Oracle v9.2 includes the following features:
- Signed versions of NetTopologySuite GIS library are supported in EF5/EF6
- NetTopologySuite 1.14 is supported in EF5/EF6
- GeoAPI 1.7.4 is supported in EF5/EF6