Home » .Net FrameworkRSS

Adding an Entity to the objectContext via AddObject being Very slow

We've just converted our code over to start using our own POCOs instead of generated Entities.  We're pretty excited.  In our program we've found some snags where certain of our larger objects take so long(5-10 seconds) to be added to the ObjectSet that our webserver times out.  This isn't a problem across the board (in most places, saving takes  the amount of time that we are used to), but this slowness is a dealbreaker.  

Are there things that we need to be aware of that we might be doing wrong?

 

4 Answers Found

 

Answer 1

Do you see the issue when using the generated  entities?
 

Answer 2

Hello,

There are several considerations about performance in entity  Framework: lazy loading, pre-generated views, tracking and so on. In your case, there seems a timeout issue, I would suggest you build the connection manually. what I mean is to build the EntityConnection manually using ConnectionStringBuilder which demostrated here. Sometimes, this could cut off half the time  it spend.

For more performance considerations in Entity Framework, please read this documentation:
http://msdn.microsoft.com/en-us/library/cc853327.aspx

Best regards

 

Answer 3

After more debugging, we've decided that our problem  likely lies with WCF RIA Services instead of EF.  Thanks for your help, sorry that my problem is so vague.  We still don't know what's going on though

 

See our question in the WCF RIA forums:

http://forums.silverlight.net/forums/t/201409.aspx

 

Answer 4

Thanks for your reply!

But with the description in the post, it's really hard to find out where the root cause is. Would you please generate a small project to reproduce and send the project to my email? I'll try my best to help you. My email account is v-roaluoATmicrosoftDOTcom.

Best regards

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter