1. The code will execute on a single thread in a larger app that is multi-threaded. However, the testing environment I have bee using is single-threaded.
2. I do not manage my own connections.
.OpenSession() is used.
3. No transaction is used.
Here is the NHibernate code that executes between session open and dispose. It is not practical to include all of the application code. But all of the NHibernate code is listed. This code block is part of a method that is called once for each record in a text file. The program opens the text file and the NHibernate session then executes this code block for each record in the text file.
I did try it with and without the
.Flush() without any difference in login/logout behaviour.
Thank you for your assistance,
Jim
Code:
criteria = session.CreateCriteria(typeof(iLonLog));
criteria.Add(Expression.Eq("LogTime", logTime));
criteria.Add(Expression.Eq("PointName", fields[1]));
criteria.Add(Expression.Eq("Location", fields[2]));
list = criteria.List<iLonLog>();
if (list.Count == 0)
{
iLonLog log = new iLonLog();
log.iLon = iLon;
log.LogTime = logTime;
log.PointName = fields[1];
log.Location = fields[2];
log.LogSourceAddress = fields[3];
log.Priority = priority;
session.Save(log);
session.Flush();
}