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

IObjectScope.Extent problem

5 Answers 83 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.
David
Top achievements
Rank 1
David asked on 17 Nov 2010, 09:18 AM
Hi,

  I have downloaded the sample application available here http://blogs.telerik.com/atanaskorchev/posts/09-01-16/ASP_NET_Ajax_Controls_in_ASP_NET_MVC_-_Announcing_the_sample_application.aspx. The projects in there were referencing Telerik.OpenAccess but for some reason it wasn't available in the projects. So I downloaded Open access and referenced the appropriate library.

This worked but then I have now come across the following problem in file "..\Telerik.Mvc.Providers\OpenAccessMembershipProvider.cs" where "Extent" in scope.Extent isn't recognised.

using (var scope = MembershipDatabase.GetObjectScope())
            {
                //Get the user whith the same user name
                var user = (from u in scope.Extent<User>()
                            where u.UserName == username
                            select u).FirstOrDefault();
 
                scope.Transaction.Begin();
                //Update his password and push the changes to the database
                user.PasswordHash = HashString(newPassword);
                scope.Transaction.Commit();
                return true;
            }
What is the issue here?

Regards,

David

5 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 17 Nov 2010, 01:19 PM
Hi David,
Extent is an .NET 3.5 extension method to the scope, it is only available if you have a reference to the Telerik.OpenAccess.35.extensions dll and if you have a "using Telerik.OpenAccess" in that file.

Kind regards,
Jan Blessenohl
the Telerik team
See What's New in Telerik OpenAccess ORM in Q3 2010!
Monday, November 15, 11 am Eastern Time: Register here>>
Monday, November 15, 10 pm Eastern Time: Register here>>
0
David
Top achievements
Rank 1
answered on 17 Nov 2010, 01:27 PM
Hi Jan,

I am indeed using Telerik.OpenAccess and wiring things up "properly". The only thing is that I don't know if I'm using the 3.5 version. In fact, I downloaded the OpenAccess components today which might mean that I haven't got the 3.5 version. Should that be the case, what can/should I do to get things to work?

Regards,

David
0
Jan Blessenohl
Telerik team
answered on 17 Nov 2010, 01:31 PM
Hello David,
The download works with all .NET versions 2.0 or greater.

Maybe you should use IObjectScope instead of var in the using statment.

Sincerely yours,
Jan Blessenohl
the Telerik team
See What's New in Telerik OpenAccess ORM in Q3 2010!
Monday, November 15, 11 am Eastern Time: Register here>>
Monday, November 15, 10 pm Eastern Time: Register here>>
0
David
Top achievements
Rank 1
answered on 17 Nov 2010, 01:39 PM
Well, that shouldn't matter but just to move the process forward, I did. I'm still encountering the same problem.

I've attached a screenshot of the code, which incidentally has been supplied by Telerik, and as you can see, I'm referencing Telerik.OpenAccess but that scope.Extent isn't recognised. When I look in Object Browser in Visual studio, there is no method or property called "Extent".
0
Jan Blessenohl
Telerik team
answered on 17 Nov 2010, 02:49 PM
Hi David,
To use Linq you have to say "using System.Linq" as well. And you have to be sure that your project is a real .NET 3.5 or 4.0 project.

Best wishes,
Jan Blessenohl
the Telerik team
See What's New in Telerik OpenAccess ORM in Q3 2010!
Monday, November 15, 11 am Eastern Time: Register here>>
Monday, November 15, 10 pm Eastern Time: Register here>>
Tags
Development (API, general questions)
Asked by
David
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
David
Top achievements
Rank 1
Share this question
or