本文整理汇总了C#中ISessionManager.OpenSession方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionManager.OpenSession方法的具体用法?C# ISessionManager.OpenSession怎么用?C# ISessionManager.OpenSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionManager
的用法示例。
在下文中一共展示了ISessionManager.OpenSession方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSetUp
public override void OnSetUp()
{
this.container.Register(Component.For<NHibernateGenericDao>()
.ImplementedBy<NHibernateGenericDao>());
this.sessionManager = this.container.Resolve<ISessionManager>();
this.nhGenericDao = this.container.Resolve<NHibernateGenericDao>();
this.nhGenericDao2 = new NHibernateGenericDao(this.sessionManager, "sessionFactory1");
using (var session = sessionManager.OpenSession())
{
var blog1 = new Blog { Name = "myblog1" };
var blog1Item = new BlogItem
{
ItemDate = DateTime.Now,
ParentBlog = blog1,
Text = "Hello",
Title = "mytitle1"
};
blog1.Items.Add(blog1Item);
var blog2 = new Blog { Name = "myblog2" };
var blog2Item = new BlogItem
{
ItemDate = DateTime.Now,
ParentBlog = blog1,
Text = "Hello",
Title = "mytitle2"
};
blog2.Items.Add(blog2Item);
var blog3 = new Blog { Name = "myblog3" };
var blog3Item = new BlogItem
{
ItemDate = DateTime.Now,
ParentBlog = blog1,
Text = "Hello3",
Title = "mytitle3"
};
blog3.Items.Add(blog3Item);
session.Save(blog1);
session.Save(blog1Item);
session.Save(blog2);
session.Save(blog2Item);
session.Save(blog3);
session.Save(blog3Item);
}
}
开发者ID:kkozmic,项目名称:Castle.Facilities.NHibernateIntegration,代码行数:47,代码来源:NHibernateGenericDaoTestCase.cs
示例2: Startup
public static void Startup(ISessionManager sessionManager, IConnectionManager connectionManager)
{
OpenSession = () => sessionManager.OpenSession();
OpenConnection = () => connectionManager.OpenConnection(String.Empty);
}