The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Problem regarding Guid with ES (0623) and VistaDB (build 57)

Last post 08-22-2008, 7:01 AM by ElPipo. 3 replies.
Sort Posts: Previous Next
  •  08-21-2008, 9:29 AM 10864

    Problem regarding Guid with ES (0623) and VistaDB (build 57)

    Hi,

    lately I've posted about es not retrieving the primary key value (default = NewID()) and so I ended up overriding the addnew() method in my custom base class. Some new problems have been discovered since then, when I load an entity (or collection) and then modifiy it and save it to the DB I get esConcurrencyExceptions:

    Code:
    EntitySpaces.Interfaces.esConcurrencyException was unhandled by user code
    Message="Error in VistaDBProvider.esSaveDataTable" Source="EntitySpaces.Core" StackTrace: at EntitySpaces.Core.esEntity.SaveToProvider(esSqlAccessType sqlAccessType)
          at EntitySpaces.Core.esEntity.Save(esSqlAccessType sqlAccessType)    at EntitySpaces.Core.esEntity.Save()    
          at BusinessObjects.MyEntity.MyMethod(BackgroundWorker Worker)    
          at MyRootNameSpace.MyProgressBarWindow.SomeBackgroundWorker_DoWork(Object sender, DoWorkEventArgs e) 
             in C:\Documents and Settings\SomeUser\My Documents\Visual Studio 2008\Projects\CurrentVersion\MySolution\SomeFolder\CommonForms\MyProgressBarWindow.vb:line 25    
         at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)    at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
    InnerException: System.Data.DBConcurrencyException
    Message="Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." RowCount=1 Source="System.Data" StackTrace: at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
                at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)    
                at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)    
                at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows)    
                at EntitySpaces.VistaDBProvider.DataProvider.SaveDynamic(esDataRequest request)    
                at EntitySpaces.VistaDBProvider.DataProvider.EntitySpaces.Interfaces.IDataProvider.esSaveDataTable(esDataRequest request)
    InnerException:

    As you can see this time the bug occurred with the code running in a backgroundworker, but it also happens when running in the UI thread.
    Another thing is that my old code was running fine using transactions but now some transactions just won't commit. The pseudo code would look like this: 

    Code:
    Dim accounts as new accountsCollection
    Dim q as new accountsQuery("q")
    'some other query object in order to build complex query accounts.load(q) Using scope as new esTransactionScope For each account in accounts

    Dim someentity as myEntity = account.SomeTablesByForeignKey.AddNew()
    'give values to some fields Dim someOtherEntity as myOtherEntity = someEntity.SomeOtherTablesByForeignKey.AddNew() 'give values to some fields Dim aFunkyEntity as New FunkyEntity
    'Do stuff to aFunkyEntity aFunkyEntity.Save() Next 'Save() or SaveAndDiscard() as I am not using the collection after saving accounts.Save() 'some concurrencyException being thrown scope.Complete() End Using

    This kind of bug (unexpected behavior) is really annoying because I'm in real a hurry, I mean I really didn't expect wasting all this time debugging, I had planned to move forward and implement a lot of new features asap (so did my clients).  This is just some sample code but in fact It happens in a lot of places (However I've noticed this mostly happened when navigating through hierarchies).

    I'd be more than grateful if you spent some time digging into this bug.

    Regards, 


    Thanks!

    - El pipo -
  •  08-21-2008, 9:46 AM 10865 in reply to 10864

    Re: Problem regarding Guid with ES (0623) and VistaDB (build 57)

    It looks like you are doing things on different threads? is that so?

     


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  08-21-2008, 9:48 AM 10866 in reply to 10865

    Re: Problem regarding Guid with ES (0623) and VistaDB (build 57)

    Send us a TEST project that demonstrates the problem with your database and we will debug it for you. It's hard to tell what the issue is support@entityspaces.net

     


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  08-22-2008, 7:01 AM 10873 in reply to 10866

    Re: Problem regarding Guid with ES (0623) and VistaDB (build 57)

    I prepared a sample project with a sample database.... but I couldn't reproduce the problem. It's a bit frustrating. Because of the company policy I can't send the real DB and the VS Solution. I'll try to debug this myself and if it's not solved by the end of the weekend I'll prepared a sample project and database that are as close as possible to the real thing.

     


    Thanks!

    - El pipo -
View as RSS news feed in XML