Skip to content

Commit

Permalink
Convert value during update
Browse files Browse the repository at this point in the history
  • Loading branch information
chinadragon0515 committed Aug 2, 2016
1 parent a801c05 commit 0b3cfed
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Spatial;
using System.Globalization;
using System.Linq;
using System.Reflection;
Expand All @@ -17,6 +18,8 @@
using Microsoft.Restier.Core.Query;
using Microsoft.Restier.Core.Submit;
using Microsoft.Restier.Providers.EntityFramework.Properties;
using Microsoft.Restier.Providers.EntityFramework.Spatial;
using Microsoft.Spatial;

namespace Microsoft.Restier.Providers.EntityFramework.Submit
{
Expand Down Expand Up @@ -247,6 +250,21 @@ private static object ConvertToEfValue(Type type, object value)
return Convert.ToInt64(value, CultureInfo.InvariantCulture);
}

if (type == typeof(DbGeography))
{
var point = value as GeographyPoint;
if (point != null)
{
return point.ToDbGeography();
}

var s = value as GeographyLineString;
if (s != null)
{
return s.ToDbGeography();
}
}

return value;
}
}
Expand Down

0 comments on commit 0b3cfed

Please sign in to comment.