This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve
asked on 18 Jun 2010, 06:14 PM
...what's the difference between ObjectScope & GetNewObjectScope
I've always used GetNewObjectScope but the telerik tv clips are all using ObjectScopeProvider1.ObjectScope()
I've always used GetNewObjectScope but the telerik tv clips are all using ObjectScopeProvider1.ObjectScope()
4 Answers, 1 is accepted
0
IT-Als
Top achievements
Rank 1
answered on 21 Jun 2010, 10:10 AM
Hi Steve,
As far as I remember... The GetNewObjectScope() gets you a new object scope from the Database instance associated (loaded and cached upon first call) with the ObjectScopeProvider.
However, the ObjectScope property will give you the same instance of an already initialized object scope.
Regards
Henrik
As far as I remember... The GetNewObjectScope() gets you a new object scope from the Database instance associated (loaded and cached upon first call) with the ObjectScopeProvider.
However, the ObjectScope property will give you the same instance of an already initialized object scope.
Regards
Henrik
0
Hello Steve
As rightly pointed out by Henrik, 'ObjectScope()' always returns the same IObjectScope instance that is initialized the first time you invoke the method.
'GetNewObjectScope()' , as the name suggests, returns a new instance of the scope always.
Greetings,
Ady
the Telerik team
As rightly pointed out by Henrik, 'ObjectScope()' always returns the same IObjectScope instance that is initialized the first time you invoke the method.
'GetNewObjectScope()' , as the name suggests, returns a new instance of the scope always.
Greetings,
Ady
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 23 Jun 2010, 01:36 PM
So I should ignore ObjectScope and use GetPerRequestObjectScope for a web project?
0
IT-Als
Top achievements
Rank 1
answered on 23 Jun 2010, 01:56 PM
Hi Steve,
Yeah, that's right. The GetPerRequestObjectScope() does the housekeeping for you in respect to the best practices for web development.
Basically, it stores the retrieved object scope, so that each time you call the method GetPerRequestObjectScope() during a single request, you'll get the same instance of the object scope.
Regards
Henrik
Yeah, that's right. The GetPerRequestObjectScope() does the housekeeping for you in respect to the best practices for web development.
Basically, it stores the retrieved object scope, so that each time you call the method GetPerRequestObjectScope() during a single request, you'll get the same instance of the object scope.
Regards
Henrik