Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 更新数据库中的复杂实体_C#_.net_Sql_Sql Server_Database - Fatal编程技术网

C# 更新数据库中的复杂实体

C# 更新数据库中的复杂实体,c#,.net,sql,sql-server,database,C#,.net,Sql,Sql Server,Database,我正在与facebook RTU合作,获取应用程序用户付款的json更新。 为了获得更好的客户服务,我想保存facebook发送给我的所有json字符串,但要按顺序保存 比如说,, 我得到了这个json: { "id": "3603105474213890", "user": { "name": "Daniel Schultz", "id": "221159" }, "application": { "name": "Friend Smash",

我正在与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; }
        }
public class paymentdetailsdo
{
公共字符串id{get;set;}
公共paidUserTo用户{get;set;}
应用程序{get;set;}的公共paidApplication数据
公共列表操作{get;set;}
公共可退款金额到可退款金额{get;set;}
公共列表项{get;set;}
公共字符串国家{get;set;}
创建的公共字符串\u time{get;set;}
公共int测试{get;set;}
公共整数支付外汇汇率{get;set;}
公共列表{get;set;}
}
您建议如何在db中表示此实体

如您所见,我的根对象中有三个
列表
对象,这使得决定如何保存它有点复杂

  • 我们不会使用EntityFramework或NHibernate

您的意思是需要数据模型?为什么不使用EntityModel?这似乎正是创建它的目的。我知道,如果可以的话,我会使用类似NHibernate的东西。这是一个旧代码,我不能改变太多,但我正在尽力做到最好。如果你有一个如何设计它的想法,我会很高兴听到。我们仅将此信息用于客户支持。它不是我们应用程序的一个重要部分。当您不使用最新版本的SQL server时,Nhibernate工作得很好,否则我会考虑使用entity Framework。我正在寻找entityframework以外的东西。。