Persistence

Thread is closed for posting
2 posts, 1 answers
  1. Randy Minder
    Randy Minder avatar
    20 posts
    Member since:
    Aug 2009

    Posted 28 Aug 2009 Link to this post

    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
  2. Answer
    PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 31 Aug 2009 Link to this post

    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.
Back to Top