0

次のコードは、SaveChanges() で次の例外をスローします。

System.Data.Services.Client.DataServiceRequestException was unhandled
  HResult=-2146233079
  Message=An error occurred while processing this request.
  Source=Microsoft.Data.Services.Client
  StackTrace:
       at System.Data.Services.Client.SaveResult.HandleResponse()
       at System.Data.Services.Client.BaseSaveResult.EndRequest()
       at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
       at System.Data.Services.Client.DataServiceContext.SaveChanges()
       at AirportDataImporter.Program.Main(String[] args) in c:\Projects\Airport\Dev\AirportWeb\AirportDataImporter\Program.cs:line 23
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Data.Services.Client.DataServiceClientException
       HResult=-2146233079
       Message=Format Exception: Invalid 'Point' format!
    at Function.$data.GeographyBase.validateGeoJSON (/usr/lib/node_modules/jaydata/lib/TypeSystem/Types/Geography.js:75:29)
    at GeographyPoint.GeographyBase (/usr/lib/node_modules/jaydata/lib/TypeSystem/Types/Geography.js:6:25)
    at new GeographyPoint (/usr/lib/node_modules/jaydata/lib/TypeSystem/Types/Geography.js:94:29)
    at $data.oDataConverter.fromDb.$data.GeographyPoint (/usr/lib/node_modules/jaydata/lib/Types/StorageProviders/oData/oDataConverter.js:55:64)
    at Airport.$data.Entity.$data.Class.define.constructor (/usr/lib/node_modules/jaydata/lib/Types/Entity.js:189:41)
    at Airport.Entity (eval at <anonymous> (/usr/lib/node_modules/jaydata/lib/TypeSystem/TypeSystem.js:463:20))
    at new Airport (eval at <anonymous> (/usr/lib/node_modules/jaydata/lib/TypeSystem/TypeSystem.js:463:20))
    at EntitySetProcessor.$data.Class.define.invoke (/usr/lib/node_modules/jaydata/lib/JayService/OData/EntitySetProcessor.js:61:38)
    at JSObjectAdapter.$data.Class.define.processRequest (/usr/lib/node_modules/jaydata/lib/JayService/JSObjectAdapter.js:89:37)
    at JSObjectAdapter.$data.Class.define.handleRequest (/usr/lib/node_modules/jaydata/lib/JayService/JSObjectAdapter.js:165:26)
       StatusCode=500
       InnerException: 

これは、C# の GeographyPoint を同等の json/javascript に変換することと関係があります。これを機能させるために何をする必要があるか誰か教えてもらえますか? JayStack データ インポーターがないように見えるため、データを初期化するためにこれを機能させる必要があります。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Spatial;
using System.Text;
using System.Threading.Tasks;

namespace AirportDataImporter
{
    class Program
    {
        static void Main(string[] args)
        {
            var db = new AirportDB.mydatabaseService(new Uri("https://open.jaystack.net/c72e6c4b-27ba-49bb-9321-e167ed03d00b/6494690e-1d5f-418d-adca-0ac515b7b742/api/mydatabase/"));

            var airport = new AirportDB.Airport();
            airport.Abbrev = "Foo";
            airport.Name = "Bar";

            airport.GeoLocation = GeographyPoint.Create(51.87796, -176.64603);
            db.AddToAirport(airport);

            db.SaveChanges();

        }
    }
}

さらに、Visual Studio によって生成されたサービスは、jaydata が別の例外をスローする odata バージョン 2 のハード コードを参照します。これを修正するために、生成されたプロキシ ファイルを手動で v3 に編集しました。これは理想的な方法ではありません。その点で何か指針はありますか?

Fiddler がキャプチャしたネットワーク ペイロードは次のとおりです。

    <?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
   <category term="mydatabase.Airport" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
   <id />
   <title />
   <updated>2013-06-16T12:16:11Z</updated>
   <author>
      <name />
   </author>
   <content type="application/xml">
      <m:properties>
         <d:Abbrev>Foo</d:Abbrev>
         <d:GeoLocation m:type="Edm.GeographyPoint">
            <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
               <gml:pos>51.87796 -176.64603</gml:pos>
            </gml:Point>
         </d:GeoLocation>
         <d:id m:null="true" />
         <d:Name>Bar</d:Name>
      </m:properties>
   </content>
</entry>

ありがとうTJ

4

1 に答える 1

0

fiddler または burp でネットワーク トラフィックをキャッチし、関連する部分をここに貼り付けます。

于 2013-06-16T04:53:33.243 に答える