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

瀏覽次數:16 次
跳到第一則未讀訊息

Karsten Kaehler

未讀,
2016年5月4日 上午9: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日 凌晨1: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 則新訊息