Re: X DevApi - C# strongly typed objects
Posted by: Satish Bodake
Date: October 25, 2022 04:44PM

Thanks for the reply. Given link doesn't have any samples for storing complex objects as document in the DB. All samples are pretty basic, and not really useful.

Below sample is very basic

// Create a new collection
var myColl = db.CreateCollection("my_collection");

// Insert a document
myColl.Add(new { name = "Laurie", age = 19 }).Execute();

I want to add my custom type via .Add() method, this method accepts object type, and upon method execution it creates an entry into collection. But when I retrieve that document using GetOne() method, it retrieved successfully but not sure how to convert back Dbdoc type to original C# object.

Options: ReplyQuote

Written By
Re: X DevApi - C# strongly typed objects
October 25, 2022 04:44PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.