public void Can_Init_NHibernate_Session() { var session = NHibernateSession.Current; using (var trans = session.BeginTransaction()) { var result = session.QueryOver<Category>().List(); var item1 = result.FirstOrDefault(); var news = new News { Title = "Title 2", ShortDescription = "Sort description 1", Content = "Content 1" }; var poll = new Poll { Value = 1, WhoVote = "ThangChung", VoteDate = DateTime.Now }; var user = new User { UserName = "******", Password = "******" }; news.AssignCategory(item1); news.AssignPoll(poll); user.AssignPoll(poll); session.Save(news); session.Save(poll); session.Save(user); session.Flush(); } }
public void Can_Init_NHibernate_Session() { var session = NHibernateSession.Current; using (var trans = session.BeginTransaction()) { var result = session.QueryOver <Category>().List(); var item1 = result.FirstOrDefault(); var news = new News { Title = "Title 2", ShortDescription = "Sort description 1", Content = "Content 1" }; var poll = new Poll { Value = 1, WhoVote = "ThangChung", VoteDate = DateTime.Now }; var user = new User { UserName = "******", Password = "******" }; news.AssignCategory(item1); news.AssignPoll(poll); user.AssignPoll(poll); session.Save(news); session.Save(poll); session.Save(user); session.Flush(); } }