1

私は Facebook RTU を使用しており、アプリケーションのユーザーの支払いに関する json の更新を取得しています。より良い顧客サービスを提供するために、Facebookが送信するすべてのjson文字列を保存したいのですが、順序付けられた方法で。

たとえば、次の json を取得しています。

{
  "id": "3603105474213890",
  "user": {
    "name": "Daniel Schultz",
    "id": "221159"
  },
  "application": {
    "name": "Friend Smash",
    "namespace": "friendsmashsample",
    "id": "241431489326925"
  },
  "actions": [
    {
      "type": "charge",
      "status": "completed",
      "currency": "USD",
      "amount": "0.99",
      "time_created": "2013-03-22T21:18:54+0000",
      "time_updated": "2013-03-22T21:18:55+0000"
    }
  ],
  "refundable_amount": {
    "currency": "USD",
    "amount": "0.99"
  },
  "items": [
    {
      "type": "IN_APP_PURCHASE",
      "product": "http://www.friendsmash.com/og/friend_smash_bomb.html",
      "quantity": 1
    }
  ],
  "country": "US",
  "created_time": "2013-03-22T21:18:54+0000",
  "payout_foreign_exchange_rate": 1,
  "disputes": [
    {
      "user_comment": "I didn't receive my item! I want a refund, please!",
      "time_created": "2013-03-24T18:21:02+0000",
      "user_email": "email\u0040domain.com"
    }
  ]
}

そして、私はそれをdbに保存したいのですが、文字列としてではなく、このスタイルのオブジェクトとして保存し、dbからフィールド値でクエリするオプションもあります。

        public class PaymentDetailsDto
        {
            public string id { get; set; }
            public PaidUserDto user { get; set; }
            public PaidApplicationDto application { get; set; }
            public List<PaymentActionDto> actions { get; set; }
            public RefundableAmountDto refundable_amount { get; set; }
            public List<PaymentItemDto> items { get; set; }
            public string country { get; set; }
            public string created_time { get; set; }
            public int test { get; set; }
            public int payout_foreign_exchange_rate { get; set; }
            public List<DisputeDto> disputes { get; set; }
        }

このエンティティをデータベースでどのように表現することをお勧めしますか?

ご覧のとおりList、ルート オブジェクトには 3 つのオブジェクトがあり、これが保存方法を決定するのを少し複雑にしています。

  • EntityFramework や NHibernate は使用しません。
4

0 に答える 0