MongoDB and C# syntax

by 10. March 2010 02:42

Normally while using mongodb-csharp driver you have to add new fields with sequential Appends.

Well, personally I prefer

Document doc = new Document(); 
            doc.Fill( 
                Width => 100, 
                Height => 200, 
                Attributes => new Pairs{ attr1 => 1, 
                                         attr2 => 2 });

over

          

Document oldstyle = new Document() 
                .Append("Width", 100) 
                .Append("Height", 200) 
                .Append("Attributes", new Document().Append("attr1", 1) 
                                                    .Append("attr2", 2));

Do you like the first case? Try MongoDB C# eXtras

Tags: ,

My code

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name: Ilya Khaprov (rus Илья Хапров)

Age: 25

Sex: Male

I'm a postgraduate (an "aspirant" in Russian terminology see Wikipedia for details) at Bryansk State Technical University.

I'm working with .Net since 2004. Also i like lisp.

My research interests lie in the area of Intelligence. In particular i am studing personal information filters, ontology learning, and some other stuff.

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2011

Recent Visitors