This is a migrated thread and some comments may be shown as answers.

Connection in ASP.NET

2 Answers 57 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 14 Jul 2011, 09:48 AM
Hi,

maybe a double post, but regarding Open Access I'm always asking myself if I'm reading a post or a blog on the old or the new way... the doc and blogs are not dated so that makes it that much harder...

I'm having some general questions regarding Open Access, latest version Q2 2011. I'll post them separately.

Q: In the car rental demo a per request context connection is demonstrated. if, at any time in the lifcycle of the request a connection is requested, a instance of the context is created and saved in the request. in the Application.EndRequest event the context is closed.

Isn't this slowing down every request? why not save it at httpapplication level? (HttpContext.Current.Application("var")=new context)

Can I also consider an per session connection? what do you advise in a multiuser environment?

Regards,

Erik

2 Answers, 1 is accepted

Sort by
0
Accepted
Zoran
Telerik team
answered on 15 Jul 2011, 12:35 PM
Hello Erik,

 The creation of a context is a very lightweight operation and is not slowing the application down. Creating/Disposing a context does not mean opening and closing a connection. The connections are held in a pool which is on its side static for the application. When a context decides to perform a CRUD operation it just gets a connection from the pool and that connection is already initialized so you have minimal performance penalty for that operation. If the context is only created and disposed - it doesn't even get a connection from the pool so there is absolutely no performance penalty with that approach.

Greetings,
Zoran
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Erik
Top achievements
Rank 2
answered on 19 Jul 2011, 12:04 PM
Hi Zoran,

Ok, if you say so, I'll believe you... :-)

when I'm debugging it seems to last a while, but well, thats debugging of course..

I'm gone try it out, thanks.

Erik
Tags
Development (API, general questions)
Asked by
Erik
Top achievements
Rank 2
Answers by
Zoran
Telerik team
Erik
Top achievements
Rank 2
Share this question
or