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

Persistence

1 Answer 54 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.
Randy Minder
Top achievements
Rank 1
Randy Minder asked on 28 Aug 2009, 07:53 PM
I'm going through the ORM tutorial and I notice that much is made of persistent classes. Can someone tell me what this means and how it relates to how OpenAccess functions?

Thanks - Randy

1 Answer, 1 is accepted

Sort by
0
Accepted
PetarP
Telerik team
answered on 31 Aug 2009, 12:45 PM
Hello Randy Minder,

Telerik OpenAccess ORM uses the persistent classes to "communicate" with the database. Your database tables are represented by the persistent classes in your application. Every class that is marked with the [Persistent] attribute can be persisted to the database. So lets say that you have a class called Order and this class is marked as Persistent. Whenever you create new order in your application and add it to the object scope, this new order will be added to the database in the corresponding table (in our case Orders). Here is an example:
scope.Transaction.Begin(); 
Order ord = new Order(){ Freight=100, ShipCity="sofia"}; 
scope.Add(ord); 
scope.Transaction.Commit(); 

Best wishes,
Petar
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Randy Minder
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or