There are many different ways to achieve the conversion between the Objects returned by EosSharp and MongoDb.
If you only want to convert the data to a string and store it in a MongoDB, it only depends on wich part of the data you want to store.
A possible simple (but CPU-consuming because of the string-conversions) solution probably looks like the following:
var resultaction = await DefaultApi.GetActions(new GetActionsRequest()
{
account_name = "dqzmember",
pos = 0,
offset = 30
});
string globalActionJson = JsonSerializer.Serialize<EosSharp.Core.Api.v1.GlobalAction>(resultAction);
// serializes the whole Response to a json
foreach (GlobalAction action in resultaction.actions)
{
action.ToString()
// only returns the full qualified name of the object
// ("EosSharp.Core.Api.v1.GetActionsResponse") or something similar
string actionJson = JsonSerializer.Serialize<EosSharp.Core.Api.v1.GetActionsResponse>(action);
// serializes each individual action to a json-String
action.action_trace.act.data.ToString();
// converts the action_trace only to string
}
Once you have your json-strings, you could simply do
BsonDocument document = BsonDocument.Parse(somejson);
while using MongoDB C# - BsonDocument Class
and store the Document in your DB.
A better solution would be to write your own classes with serializers/serialization and convert the obejcts returned by EosSharp to something you can process in your C#-buisnes-logic.