IObjectScope.Extent problem

6 posts, 0 answers
  1. David
    David avatar
    5 posts
    Member since:
    Oct 2010

    Posted 17 Nov 2010 Link to this post

    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
  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 17 Nov 2010 Link to this post

    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>>
  3. DevCraft banner
  4. David
    David avatar
    5 posts
    Member since:
    Oct 2010

    Posted 17 Nov 2010 Link to this post

    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
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 17 Nov 2010 Link to this post

    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>>
  6. David
    David avatar
    5 posts
    Member since:
    Oct 2010

    Posted 17 Nov 2010 Link to this post

    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".
  7. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 17 Nov 2010 Link to this post

    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>>
Back to Top
DevCraft banner