This question is locked. New answers and comments are not allowed.
Nathan J Pledger
Top achievements
Rank 2
Nathan J Pledger
asked on 22 Dec 2008, 01:10 PM
Hi,
Still learning ....
Everyone seems to be talking about a scope.Extent object when talking about LINQ, but how do I get this object?
I have:
... but the scope object does not return a .Extent property. Do I need to cast the IObjectScope out to something else?
Still learning ....
Everyone seems to be talking about a scope.Extent object when talking about LINQ, but how do I get this object?
I have:
using (IObjectScope scope = Database.Get(_session.ConnectionId).GetObjectScope()) |
{ |
// "scope.Extent" does not exist! |
} |
... but the scope object does not return a .Extent property. Do I need to cast the IObjectScope out to something else?
13 Answers, 1 is accepted
0
Accepted
Hi Nathan,
"Extent" is an extension method for using the OpenAccess scope in Linq queries. If you want to enable it, include the "Telerik.OpenAccess.Query" namespace.
Greetings,
Alexander
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
"Extent" is an extension method for using the OpenAccess scope in Linq queries. If you want to enable it, include the "Telerik.OpenAccess.Query" namespace.
Greetings,
Alexander
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nathan J Pledger
Top achievements
Rank 2
answered on 23 Dec 2008, 02:27 PM
That's got it, thanks Alexander.
0
Nathan J Pledger
Top achievements
Rank 2
answered on 23 Dec 2008, 02:29 PM
By the way, had 2 glowing Tweets sent to me yesterday about your service on Twitter when I said I was working with Telerik/OpenAccess.
0
Simon
Top achievements
Rank 1
answered on 14 Jul 2010, 01:27 PM
Hi, I'm having the same problem: The Extent method doesn't exist on IObjectScope.
After reading this thread, I tried adding a line
using Telerik.OpenAccess.Query;
After reading this thread, I tried adding a line
using Telerik.OpenAccess.Query;
but that in turn gives me another error
Error 19 Using the generic type 'Telerik.OpenAccess.Query<T>' requires 1 type
Am I missing something else?
0
Hi Simon,
The using is not necessary but you have to add a reference to Telerik.OpenAccess.35.Extensions.dll.
Sincerely yours,
Jan Blessenohl
the Telerik team
The using is not necessary but you have to add a reference to Telerik.OpenAccess.35.Extensions.dll.
Sincerely yours,
Jan Blessenohl
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
Simon
Top achievements
Rank 1
answered on 14 Jul 2010, 03:44 PM
Thanks Jan, but I'm afraid I already have that reference.
I've attached a screenshot that shows project refs and the intellisense window on the interface.
??
I've attached a screenshot that shows project refs and the intellisense window on the interface.
??
0
Hi Simon,
Ah, now I see it, it is in the Telerik.OpenAccess namespace. You have to add a using for that.
Kind regards,
Jan Blessenohl
the Telerik team
Ah, now I see it, it is in the Telerik.OpenAccess namespace. You have to add a using for that.
Kind regards,
Jan Blessenohl
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
Simon
Top achievements
Rank 1
answered on 14 Jul 2010, 06:25 PM
That worked, thanks Jan
0
Bassel
Top achievements
Rank 1
answered on 06 Feb 2011, 11:36 AM
Hi
I still can't get the scope thing
I've add
using Telerik.OpenAccess.Query;
but how can I get the scope object itself??
I still can't get the scope thing
I've add
using Telerik.OpenAccess.Query;
but how can I get the scope object itself??
0
Hi Bassel,
In the latest versions of Telerik OpenAccess the Telerik.OpenAccess.Query namespace is no longer needed in order to use the Extent<T> method. The method is now part of the root Telerik.OpenAccess namespace.
Could you please tell us which of the OpenAccess approaches you are using - the "classic" Forward/Reverse mapping wizards or the new visual designer? If you are using the new designer, you will have to use the auto-generated OpenAccessContext class to manage persistent objects instead of an object scope. Please try to give some more details on what you are trying to achieve, so we can help you further.
All the best,
Alexander
the Telerik team
In the latest versions of Telerik OpenAccess the Telerik.OpenAccess.Query namespace is no longer needed in order to use the Extent<T> method. The method is now part of the root Telerik.OpenAccess namespace.
Could you please tell us which of the OpenAccess approaches you are using - the "classic" Forward/Reverse mapping wizards or the new visual designer? If you are using the new designer, you will have to use the auto-generated OpenAccessContext class to manage persistent objects instead of an object scope. Please try to give some more details on what you are trying to achieve, so we can help you further.
All the best,
Alexander
the Telerik team
0
Bassel
Top achievements
Rank 1
answered on 07 Feb 2011, 08:51 PM
Hi
thanks for the help
I think you've already answered me, coz I'm using the new visual designer
thnx
thanks for the help
I think you've already answered me, coz I'm using the new visual designer
thnx
0
Gopinath
Top achievements
Rank 1
answered on 24 Jan 2012, 05:37 PM
Hello,
when I use this statement:
scope.extent<ObjectName>().where(<condition for filter>)
Does it brings all the records from the table and then does the filter or it just retreives only filtered records from the DB.
Pls. advise.
when I use this statement:
scope.extent<ObjectName>().where(<condition for filter>)
Does it brings all the records from the table and then does the filter or it just retreives only filtered records from the DB.
Pls. advise.
0
Hello,
when you use
Scope.Extent<Type>().Where(ConditionLambda)
nothing happens. This is because LINQ is evaulated lazily, which means, that you have to obtain the values from the IQueryable<Type> that you defined. When you do so (most likely by issuing .GetEnumerator() on that query instance), the complete expression tree - that is only known then - will be inspected and transformed. In the case of the query as given above, OpenAccess will push the ConditionLambda expression as filter to a SQL query, and only the filtered instances will be brought from the server to the client memory.
Thomas
the Telerik team
when you use
Scope.Extent<Type>().Where(ConditionLambda)
nothing happens. This is because LINQ is evaulated lazily, which means, that you have to obtain the values from the IQueryable<Type> that you defined. When you do so (most likely by issuing .GetEnumerator() on that query instance), the complete expression tree - that is only known then - will be inspected and transformed. In the case of the query as given above, OpenAccess will push the ConditionLambda expression as filter to a SQL query, and only the filtered instances will be brought from the server to the client memory.
Thomas