NHibernate 源码@https ://github.com/nhibernate
来自 Isession @ NHibernate.Impl.SessionImpl 的会话实现
public ITransaction BeginTransaction()
{
using (new SessionIdLoggingContext(SessionId))
{
if (rootSession != null)
{
// Todo : should seriously consider not allowing a txn to begin from a child session
// can always route the request to the root session...
log.Warn("Transaction started on non-root session");
}
CheckAndUpdateSessionStatus();
return connectionManager.BeginTransaction();
}
}
public ITransaction Transaction
{
get { return connectionManager.Transaction; }
}
来自 NHibernate.Adonet.ConnectionManager 类
public ITransaction BeginTransaction()
{
Transaction.Begin();
return transaction;
}
public ITransaction Transaction
{
get
{
if (transaction == null)
{
transaction = session.Factory.TransactionFactory.CreateTransaction(session);
}
return transaction;
}
}