Obsolete
Details
Details
Assignee
Bill Pierce
Bill PierceReporter
Constant.jon
Constant.jonComponents
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created April 2, 2009 at 12:40 AM
Updated May 18, 2017 at 11:32 PM
Resolved May 18, 2017 at 11:32 PM
/****** following code is written into "default.aspx.cs of "quickstart project" ******/
using NHibernate;
using NHibernate.Tool.hbm2ddl;
using QuickStart;
protected void Page_Load(object sender, EventArgs e)
{
ISession session = NHibernateHelper.GetCurrentSession();
ITransaction tx = session.BeginTransaction();
Cat princess = new Cat();
princess.Name = "Princess";
princess.Sex = 'F';
princess.Weight = 7.4f;
session.Save(princess);
tx.Commit();
NHibernateHelper.CloseSession();
}
/**********following code is written into "Helper.cs" of "Cat.project"***************/
using NHibernate;
using NHibernate.Cfg;
public static ISession GetCurrentSession()
{
System.Web.HttpContext context = HttpContext.Current;
ISession currentSession = context.Items[CurrentSessionKey] as ISession;
if (currentSession == null)
{
currentSession = sessionFactory.OpenSession();
context.Items[CurrentSessionKey] = currentSession;
}
return currentSession;
}
I always get a error message . the VS.net said that you couldn't load file or assmebly "NHibernate.ProxyGenerators.CastleDynamicProxy" or a dependency of it . system cannot find the file...
How do I ?