com+ question
-
I have a simple little componnent below. Why is the ouput 1 then 0 ? I don't understand why the instance variable is reset after the transaction is completed ?
using System;
using System.Runtime.CompilerServices;
using System.EnterpriseServices;
using System.Reflection;
using System.Runtime.InteropServices;[assembly: ApplicationName("TestApp")]
[assembly: ApplicationAccessControl(false)]
[assembly: AssemblyKeyFileAttribute("TestApp.snk")][Transaction(TransactionOption.Required)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class Test : ServicedComponent
{
protected int i;
public int I
{
get
{
return i;
}
}[AutoComplete]
public void test()
{
i++;
Console.WriteLine( i );
}
}public class client
{
public static int Main()
{
Test t = new Test();
t.test();
Console.WriteLine( t.I );
return 0;
}
}