Example #1
0
        private ODataAdapter(ISession session, string protocolVersion)
        {
            _session        = session;
            ProtocolVersion = protocolVersion;

            CustomConverters.RegisterTypeConverter(typeof(GeographyPoint), TypeConverters.CreateGeographyPoint);
            CustomConverters.RegisterTypeConverter(typeof(GeometryPoint), TypeConverters.CreateGeometryPoint);
        }
Example #2
0
        public ODataAdapter(ISession session, IODataModelAdapter modelAdapter)
        {
            _session        = session;
            ProtocolVersion = modelAdapter.ProtocolVersion;
            Model           = modelAdapter.Model as IEdmModel;

            CustomConverters.RegisterTypeConverter(typeof(GeographyPoint), TypeConverters.CreateGeographyPoint);
            CustomConverters.RegisterTypeConverter(typeof(GeometryPoint), TypeConverters.CreateGeometryPoint);
        }
        public void ToObjectSpatialV4()
        {
            CustomConverters.RegisterTypeConverter(typeof(SpatialV4.GeographyPoint), V4.Adapter.TypeConverters.CreateGeographyPoint);
            var dict = new Dictionary <string, object>()
            {
                { "PointV4", SpatialV4.GeographyPoint.Create(SpatialV4.CoordinateSystem.Geography(100), 1, 2, null, null) },
            };

            var value = dict.ToObject <ClassType>();

            Assert.Equal(100, value.PointV4.CoordinateSystem.EpsgId);
            Assert.Equal(1d, value.PointV4.Latitude);
            Assert.Equal(2d, value.PointV4.Longitude);
        }