question.does it work if you put a BeginTransaction after the OpenSession ?

2009/10/7 Ayende Rahien <[email protected]>

> I am trying to figure out why this is failing, but I can't figure it out
> (attached is a patch against trunk for this test).
> Any ideas?
>
> [Test]
>
> public void CanLoadAndSaveWithDtc()
>
> {
>
> object id;
>
> using (ISession s = sessions.OpenSession())
>
> using(s.BeginTransaction())
>
> {
>
> var person = new Person {CreatedAt = DateTime.Now};
>
> id = s.Save(person);
>
>
>  s.Transaction.Commit();
>
> }
>
> using (var tx = new TransactionScope())
>
> using (ISession s = sessions.OpenSession())
>
> {
>
> s.Get<Person>(id);
>
>
>  new ForceEscalationToDistributedTx();
>
>
>  s.Save(new Person
>
> {
>
> CreatedAt = DateTime.Now
>
> });
>
>  tx.Complete();
>
> }
>
>
>  using (ISession s = sessions.OpenSession())
>
> using (s.BeginTransaction())
>
> {
>
> s.Delete("from Person");
>
> s.Transaction.Commit();
>
> }
>
>
> }
>



-- 
Fabio Maulo

Reply via email to