Entity out of sync exception with UltraGrid?

Posts   
 
    
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 11-Dec-2006 07:09:36   

I've a entity collection and which is data bind to an UltraGrid, it throw the out of sync exception after saving sometimes, not everytime, I've refetched the entity after saving, I've no ideas why it throw this exception.

Exception: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at SD.LLBLGen.Pro.ORMSupportClasses.EntityPropertyDescriptor2.GetValue(Object component) at Infragistics.Win.UltraWinGrid.UltraGridRow.GetCellValue(UltraGridColumn column)

Inner Exception: The entity is out of sync with its data in the database. Refetch this entity before using this in-memory instance. at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.GetCurrentFieldValue(Int32 fieldIndex) at XXX.SalesOrderDetailEntity.get_ItemNo()

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 11-Dec-2006 08:33:57   

Are you using a bindingSource?

Would you please post a code snippet of the binding action as well as any grid events handlers?

Max avatar
Max
User
Posts: 221
Joined: 14-Jul-2006
# Posted on: 11-Dec-2006 17:00:07   

Barry wrote:

I've a entity collection and which is data bind to an UltraGrid, it throw the out of sync exception after saving sometimes, not everytime, I've refetched the entity after saving, I've no ideas why it throw this exception.

Have you tried to enable/disabe ultragrid things?


        ultraGrid.SuspendLayout()
        ultraGrid.SuspendRowSynchronization()
        ultraGrid.SuspendSummaryUpdates()


        [... do data save/fetch/refetch stuff...]


        ultraGrid.ResumeSummaryUpdates(True)
        ultraGrid.ResumeRowSynchronization()
        ultraGrid.ResumeLayout()

Have you tried to use a BindingSource object between EntityCollection and ultragrid?