小编Sha*_*ood的帖子

类属性不包括在sqlite数据库列中

我有一个实体类

  public class someclass
  {
      public string property1 {get; set;}
      public string property2 {get; set;}
      public string property3 {get; set;}
  }
Run Code Online (Sandbox Code Playgroud)

并使用sqlite连接类obj DB我正在创建表

  Db.CreateTableAsync<someclass>().GetAwaiter().GetResult();
Run Code Online (Sandbox Code Playgroud)

我想要实现的是,我不希望sqlite在表中创建列property3.有没有办法实现这个目标?

我正在使用SQLiteAsync库来存储Windows应用程序.

c# sqlite windows-runtime windows-store-apps sqlite-net

22
推荐指数
2
解决办法
1万
查看次数

仅反序列化 JSON 响应的单个节点

我有一个 json 响应,例如

{
  "appStatus":{
    "status":true
  },
  "lastSyncDate":"06-07-2013 13.54.27",
  "configResponse":{
    "status":{
      "status":true
    },
    "configs":{
      "APPLOGENABLED":{
        "configCode":"APPLOGENABLED",
        "configDesc":"enable or disable logging from front end",
        "configType":"TAB",
        "configValue":"Y"
      },
      "COMMENTSTIMER":{
        "configCode":"COMMENTSTIMER",
        "configDesc":"timer for comments in seconds",
        "configType":"TAB",
        "configValue":"60"
      },
      "SUMMARYTIMER":{
        "configCode":"SUMMARYTIMER",
        "configDesc":"timer for summary in seconds",
        "configType":"TAB",
        "configValue":"30"
      },
      "ALERTSTIMER":{
        "configCode":"ALERTSTIMER",
        "configDesc":"timer for alerts in seconds",
        "configType":"TAB",
        "configValue":"60"
      }
    },
    "lastSyncDate":"06/07/2013 13.48.13"
  }
}
Run Code Online (Sandbox Code Playgroud)

使用 json.NET,我想提取configResponse到字典中。我知道我可以像这样直接转换 Dictionary 对象

  JsonConvert.DeserializeObject<Dictionary<string,string>>().... 
Run Code Online (Sandbox Code Playgroud)

但由于configResponse是一个子元素,我无法根据需要解析它。

我想将上面的 json 响应反序列化为

public class ConfigResponse
{
    public Status …
Run Code Online (Sandbox Code Playgroud)

.net c# json dictionary json.net

2
推荐指数
1
解决办法
2733
查看次数