To delete my integration tests, I delete every old data and insert new test data before each exam Am I inquiring about all institutions and removing them one by one, is there a better way of doing this?
I have considered writing a stored procedure that is removed from " tablename "; For each table that has to be cleaned. It is quite fast, but it would be nice to call without the queries or to the SP via NH.
I am using Vanilla NHibernate and Linq NHibernate. I make Castle Active Records similar to FU.Delital (), but I do not want to use active records for this project.
Any thoughts?
Thank you / Eric
Update:
Since this question was answered and answered, the NHibernate team progressed As you can see, in Ayende, now you can directly execute DML questions, to bring any organization without NHibernate.
To delete all Foo objects, you can do this:
(eSession session = ...) (iTransaction transaction = session.) Benifference ()) {session .CreateQuery ("Delete FUFF"). ExecuteUpdate (); Transaction.Commit (); }
This query will generate the following SQL:
Delete from foo
which is pretty fast Before attracting and removing them Be careful though, because as these questions do not affect level 1 cache.
Units in my tire down, I mostly do this:
Use (eSation S = ...) (S. Dealet (from "Object O"); s.Flush ();}
It should remove all entities if you If you want to delete all instances of a specific unit, you can:
use (eSation S = ....) {s.Delete (from "MyEntityName e") ; S.Flush ();}
Offcourse, there is a flaw with this method, and that is that NHibernate first Institutions will receive them before removing them.
Comments
Post a Comment