[.NET Driver] "Disconnecting" an object from MongoDB

已查看 16 次
跳至第一个未读帖子

Karsten Kaehler

未读,
2016年5月4日 09:31:442016/5/4
收件人 mongodb-user
Hi folks,
I need some help!


If I try something like this

     var collection = _database.GetCollection<SomeObject>("Records");

     
foreach (SomeObject s in collection.ToList())
     
{
         anotherObject
.SomeProperty = s.SomeProperty;
     
}


where anotherObject is not mapped to a MongoDb Collection I get an access to the database everytime I try to read from anotherObject.SomeProperty, which gives me a huge performance hit.
How can I get rid of this behaviour?

Many thanks!

Wan Bachtiar

未读,
2016年5月9日 01:20:262016/5/9
收件人 mongodb-user

where anotherObject is not mapped to a MongoDb Collection I get an access to the database everytime I try to read from anotherObject.SomeProperty, which gives me a huge performance hit.

Hi Karsten,

Could you please answer the following:

  • How do you observe the “access to the database” every time you read anotherObject.SomeProperty?
  • How do you measure the performance hit ?
  • What is the value type of SomeProperty ? i.e. is it another object ?
  • Could you provide example mapping of the classes ?
  • Which version of MongoDB C# driver are you using ?

Kind regards,

Wan.

回复全部
回复作者
转发
0 个新帖子