I also found that the most time consuming in the stateless session is
creating Proxies when the materializing is done.
I'm using NHibernate 2.0.
The object SessionScope is encapsulating the real Session/
StatelessSession.
This is the TestUnit Code:
[Test]
public void TestStatelessSession()
{
long ts, ts1;
BDManagerBaseClass.GetInstance();
using (SessionScope scope =
BDManagerBaseClass.Instance.NewSessionScope())
{
scope.DisableAutoFlush();
Stopwatch sw = new Stopwatch();
sw.Start();
IList<ConnectionTime> times =
scope.Session.CreateCriteria(typeof
(ConnectionTime)).List<ConnectionTime>();
ts = sw.ElapsedMilliseconds;
}
using (StatelessSessionScope scope =
BDManagerBaseClass.Instance.NewStatelessSessionScope())
{
Stopwatch sw = new Stopwatch();
sw.Start();
IList<ConnectionTime> times =
scope.StatelessSession.CreateCriteria<ConnectionTime>
().List<ConnectionTime>();
ts1 = sw.ElapsedMilliseconds;
}
Console.WriteLine("ts: {0} ms --- ts1: {1} ms", ts, ts1);
}
This is the POCO
[Class(Table = "ConnectionTime", DynamicUpdate=true)]
public class ConnectionTime
{
#region Fields
private BusStop busStop;
private Branch branch;
#endregion
#region Properties
[Id(Column = "ID", Name = "ID", Type = "Int32")]
[Generator(1, Class = "native")]
public virtual int ID { get; set; }
[ManyToOne(Column="EPOCA")]
public virtual Season Season { get; set; }
[ManyToOne(Column="CONNECTION_ID")]
public virtual Connection Connection {get; set;}
[ManyToOne(Column="NR_VARIANTE")]
public virtual TimeVariant TimeVariant { get; set; }
[ManyToOne(Column="DIA_TIPO")]
public virtual Day Day { get; set; }
[Property(Column = "TEMPO_PERCURSO", Type = "Int32")]
public virtual int TravelTime { get; set; }
[Property(Column = "TEMPO_PARADO", Type = "Int32")]
public virtual int StopTime { get; set; }
public virtual int AccumulatedTravelTime { get; set; }
#endregion
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---