简体   繁体   中英

how to store and retrieve model in redis that has a serialized string field

I'm trying to store a model to the redis that has 3 string fields, each one is serialized JSON I have no problem in setting it and I can see it in redis insight but when getting it from redis it fires error JSON exception when digging deep into it, the problem with those string fields that contains JSON

[Document(Prefixes = new[] { "Demo" })]
public class Demo
{
    [Indexed]
    public string ReferenceNumber { get; set; }  
    [Indexed]
    public string Note { get; set; }
    [Indexed]
    public string ItemsData { set; get; }  <-- those the string fields that contains json
    [Indexed]
    public string SkillsData { get; set; }
    [Indexed]
    public string Data { get; set; }
}

I'm using redis OM with Dot Net Core 6. Furthermore, I tried to change the document type from hash to JSON and nothing happened

I didn't find a way to do so in HashSet so I decided to change the type of the document to Json and I got to retrieve the data without any problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM