Using ORM with MVC

Thread is closed for posting
2 posts, 0 answers
  1. Jim
    Jim avatar
    1 posts
    Member since:
    Mar 2009

    Posted 06 Apr 2009 Link to this post

    What is the best way to use ORM and scope with ASP.NET MVC.  Is it appropriate to keep a scope in ViewData?  Is it instead appropriate to requery data when another request is received?  What is the best way to identify changes for persisting to the database?
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 08 Apr 2009 Link to this post

    Hello Jim,

    I think it is better not to keep a scope in the ViewData and use scopes only in the controller's logic where it is necessary. If you want to work with the same scope every time, you can use a static one. While particular object lives within a scope, this scope takes care of tracking the changes. If you want to check whether an object has some not persisted changes (i.e. the object is dirty) you can use the object scope's IsDirty(persistent object) method. I believe you will find our MVC example useful if you have not seen it yet. It is available for download here.

    Regards,
    Alexander
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top