This is a migrated thread and some comments may be shown as answers.

Web service with ORM - "Change set" committting problem

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
zenus
Top achievements
Rank 1
zenus asked on 23 Aug 2011, 09:33 AM
Hi, hope not to bother you.

My project is a WCF Service between the Data Access Layer and Client Side
I used the same concept used in the "ORM-MadeEasy" reference : Web service chapter
I'm having a problem in change set.

In the client side when i delete the object it deleted it successfully
_containerHelper.Remove(object);
_containerHelper.Save(_client.objectDelegate);

but when i call the method "Load" After delete from the same container it gives me this error in committing:
if (_container.Transaction.IsActive)
        _container.Transaction.Commit();    [Here is the Exception]
 
TransactionException was unhandled
Mixed object graph: object from another ObjectScope/ObjectContainer or evicted-reachable instance.

In the client side i used the same container object in the whole project and call save after each delete or insert operation to apply synchronization with local change set.

----------------------
I would prefer if there is another way to apply web service with ORM model without change set.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 26 Aug 2011, 09:13 AM
Hello Zenus,

 the reason for this exception is that the runtime detects a mixture of objects from different sources. Each persistent object can only be managed by one context, and can only reference instances that are managed by the same context too. In your case, this model seems to be violated.
Can you please verify that not a second container or scope is in the game; apply the change set to your original ObjectContainer. 

All the best,
Thomas
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
zenus
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Share this question
or