All entities are reloaded from DB after SaveChanges called

4 posts, 0 answers
  1. Pawel
    Pawel avatar
    3 posts
    Member since:
    Nov 2011

    Posted 21 Apr 2015 Link to this post

    Hello,

     I got simple entities list connected to RadGridView (With RadObservableCollection).

    Then I change some field in RadGridView and do SaveChanges() - all changes are reflected in DB.

     Now when I scroll, filter, sort or do anything in code with any entity all entities are reloaded from DB.

     I suppose that saving any 1 item to DB changes state of all other items in that entity.

    How can I avoid reloading? ( I use 2nd level cache already)

  2. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 24 Apr 2015 Link to this post

    Hi Pawel,

    Thank you for contacting us.

    In general, the behaviour you are experiencing is expected in such scenario. It ensures that the UI always displays up-to-date values from the database. Perhaps you could share a little bit more details about the design needs that require you to rely on not-updated in-memory objects.

    I am looking forward to hearing from you.


    Regards,
    Doroteya
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Pawel
    Pawel avatar
    3 posts
    Member since:
    Nov 2011

    Posted 26 Apr 2015 in reply to Doroteya Link to this post

    Hi Doroteya,

     I'm loading about 900 rows of data for fast searching in gridview, so reloading all of them one by one with DB is freezing whole WPF application, and its really not needed at all when I change only 1 row.

     

  5. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 29 Apr 2015 Link to this post

    Hello Pawel,

    Thank you for getting back to us and for the additional information.

    As far as I understand the situation, currently when you do SaveChanges the rows of the grid are reloaded one by one, which I confirm is quite slow.

    A much performant approach that allows you display the latest state of the database is to reload the data with just one SELECT statement. if you find this feasible, you can review a sample implementation in our WPF Quick Start Scenario. It consumes plain List<T> collections to hold the binding data and the INotifyPropertyChanged interface for communication with the UI. With this approach, once the changes are committed to the database, the whole collection is retrieved with a single SELECT, and when you apply some filtering, only the relevant data are fetched with just one statement.

    I hope this helps. Let us know how the things on your side are. 

    Regards,
    Doroteya
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top