Need all rows that have been updated/created since last save from C1DataSource

Posted by: alexa.drenick on 5 December 2018, 3:37 pm EST

  • Posted 5 December 2018, 3:37 pm EST

    Hello,

    I’m using a C1DataSource connected to a SQL DB instead of a DataAdapter like I’m used to, but I need the .GetChanges() function that returns a Table of all the rows that have been changed/added since the last time SaveChanges() was called. Is this functionality available in C1DataSource? Is there any way to get all of the new/edited records so I can process them before saving them to the Database?

    Thanks!

  • Posted 9 December 2018, 3:37 pm EST

    Hi Alexa!

    I’m discussing this requirement with the concerned team, and will update you once there is found any appropriate solution to this.

    Regards,

    Meenakshi

  • Posted 11 December 2018, 2:03 am EST

    Hi, Alexa,

    Try using ObjectStateManager to track changes.

    
    	        var sm = c1DataSource1.ClientCache.ObjectContext.ObjectStateManager;
    			// get all modified records 
    	        var modified = sm.GetObjectStateEntries(System.Data.Entity.EntityState.Modified); // similar for Added, Deleted
    	        foreach (var m in modified)
    	        {
    		    // do something        
    	        }
    
    

    Refer to http://jaliyaudagedara.blogspot.com/2015/01/using-objectstatemanager-for-object.html on how to deal with the entries

    Hope this helps,

    • Alexey
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels