I apologize if I use the wrong terminology here. I still really love the ORM world, but I play with MongoDb and really love what I see. One of the things I don't like is this:
var books = bookRepository.GetCollection<BsonDocument>("books");
and
foreach (var book in books.FindAllAs<Book>()) { Console.WriteLine("Author: {0}, Title: {1}", book.Author, book.Title); }
I found some NoRM wrapper tutorials in the session , but I can't figure out how to do this using CSharp drivers (the ones that Mongodb recommends / has on its github page).
What I really would like to do is something like this for the first example:
var bookRepository = MongoRepository<Book>();
and
foreach (var book in books.FindAll())
Voila! I'm probably not the first person to want this, using the lines everywhere, seems a little crazy, although I will give that the textbook is just an example. Is there an example of โbest practiceโ to set it all up this way?
Edit: Please let me know if this is a crazy conversation and not how to do something in Mongo, again this is my first test project.
source share