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

Using ORM with MVC

1 Answer 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 06 Apr 2009, 06:05 PM
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?

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 08 Apr 2009, 02:28 PM
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.
Tags
General Discussions
Asked by
Jim
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or