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

IObjectScope.Transaction.Flush() in Q2 2010

1 Answer 43 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 13 Aug 2010, 09:35 AM
Hello.

We are investigating possibility to use new version of OpenAccess ORM for our new complex project.
We are using unit testing in our development process, and we need to run many unit tests in transaction, which is automatically cancelled after unit test is finished, so we can bring database to initial state, so other unit tests may rely on test data.

Using previous version of OpenAccess ORM and ObjectScope object we was able to call ObjectScope.Transation.Flush() in the middle of unit tests, to generate Identity fields, etc. And then rollback the whole transaction in the end of unit test.

How this can be done with new Domain Model features in Q2 2010?

Thanks,

Alex

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 13 Aug 2010, 04:49 PM
Hi Alex,

This is something that is not directly exposed through the context, however there is an easy fix you could implement. The context has an underlying scope that you can access. You have to implement a partial class of the context and in it a property that return an IObjectScope that it would get from the protected method GetScope(). 

Then you could easily call the old scope.Transaction.Flush() and be sure that context.ClearChanges would revert the changes to the database. We will be considering exposing this in the context so that you needn't use the scope.

I do hope this helps.

Sincerely yours,
Serge
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Development (API, general questions)
Asked by
Alex
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or