Using C# Dynamic with MongoDB

Nice example of using Dynamic in manipulation with  MongoDB-CSharp document

 

Instead

Document post = new Document(); 
post["Published"] = DateTime.UtcNow; 
DateTime published = ((DateTime)mongo_post["Published"]).ToLocalTime();

 

With Dynamic

dynamic post = new Document(); 
post.Published = DateTime.UtcNow; 
DateTime published = mongo_post.Published.ToLocalTime();

 

Dynamic document implementation http://www.box.net/shared/knqqd9jn9k

 

Thanks to Scott Watermasysk http://scottw.com/mongodb-dynamics

 

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com