orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Persistence not stored as json in DB

Open babula38 opened this issue 2 years ago • 4 comments

Hi, I am learning Orleans I have just created the sample provided in the docs. I found in the docs that UseJson is the default now. But still, the grains are stored as binary in the database.

image

I am attaching the code zip file below for you to look over.

OrleansURLShortener.zip

NOTE:- Tried a lot to get any information from the document, but I guess the document is not complete or missing the updates.

babula38 avatar May 03 '23 09:05 babula38

cc @benjaminpetit I think we should address this.

It's encoded as JSON but stored as binary, confusingly. In other words, you could decode that blob as UTF-8

ReubenBond avatar May 03 '23 14:05 ReubenBond

@ReubenBond is there any config change I can do to store it as JSON not binary?

I tried to decode the value in UTF-8 via the code below but am not getting the JSON back am I doing something wrong?

using System;
using System.Text;

string x="0x7B22246964223A2231222C222474797065223A2255726C44657461696C732C204F726C65616E7355524C53686F7274656E6572222C2246756C6C55726C223A2268747470733A2F2F6D6963726F736F66746767672E636F6D222C2253686F7274656E6564526F7574655365676D656E74223A223944304234393545222C224D79";
var y = Encoding.ASCII.GetBytes(x);

var z= System.Text.Encoding.UTF8.GetString(y);

Console.WriteLine("🌄"+z);

babula38 avatar May 04 '23 09:05 babula38

Meanwhile this is getting fixed you should be able to get the data using

select cast(PayloadBinary as varchar(MAX)), * from OrleansStorage

eltjo-k avatar Jun 11 '23 14:06 eltjo-k

Meanwhile this is getting fixed you should be able to get the data using

select cast(PayloadBinary as varchar(MAX)), * from OrleansStorage

Let me try this.

babula38 avatar Jun 16 '23 17:06 babula38

the cast to varchar(MAX) is working for me. does seem strange to have the double serialization. Is the intent to use the transport serializer? e.g. [generateserializer]

amccool avatar Oct 22 '24 16:10 amccool