public void OnStartUp() { SetRootPathProject(); XmlTextReader configReader = new XmlTextReader(new MemoryStream(NHibernate.Test.Properties.Resources.Configuration)); DirectoryInfo dir = new DirectoryInfo(this.rootPathProject + ".Hbm"); Console.WriteLine(dir); builder = new NhConfigurationBuilder(configReader, dir); builder.SetProperty("connection.connection_string", GetConnectionString()); try { builder.BuildSessionFactory(); sessionFactory = builder.SessionFactory; } catch (Exception ex) { Console.WriteLine(ex); throw; } sessionProvider = new SessionManager(sessionFactory); currentPagedDAO = new EnterprisePagedDAO(sessionProvider); currentRootPagedDAO = new EnterpriseRootDAO<object>(sessionProvider); currentSession = sessionFactory.OpenSession(); }
public Form1() { //Type t = typeof(User); //Type t1 = typeof(Course<>); //Type t2 = typeof(Course<Teacher>); //Type t3 = typeof(Course<Collaborator>); //Console.WriteLine(t.Name); //Console.WriteLine(t1.Name); //Console.WriteLine(t2.Name); //Console.WriteLine(t3.Name); InitializeComponent(); SetRootPathProject(); XmlTextReader configReader = new XmlTextReader(new MemoryStream(WFA_NHibernate.Properties.Resources.Configuration)); DirectoryInfo dir = new DirectoryInfo(this.rootPathProject + "MappingsXml"); builder = new NhConfigurationBuilder(configReader, dir); builder.SetProperty("connection.connection_string", GetConnectionString()); builder.BuildSessionFactory(); sessionFactory = builder.SessionFactory; sessionProvider = new SessionManager(sessionFactory); CurrentPagedDAO = new EnterprisePagedDAO(sessionProvider); this.currentSession = sessionFactory.OpenSession(); }
/// <summary> /// /// </summary> /// <param name="customDAO"></param> public QueryExecutor(INhPagedDAO customDAO) { this.customDAO = customDAO; }