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();
        }
        static Global()
        {
            string rootPath = HostingEnvironment.MapPath("~");

            XmlTextReader configReader = new XmlTextReader(File.OpenRead(string.Format("{0}/Cfg/Configuration.xml", rootPath)));
            DirectoryInfo dir = new DirectoryInfo(string.Format("{0}/Mappings", rootPath));
            NhConfigurationBuilder bld = new NhConfigurationBuilder(configReader, dir);

            bld.SetProperty("connection.connection_string", GetConnectionString(rootPath));
            bld.BuildSessionFactory();

            Sessionfactory = bld.SessionFactory;
        }
        static WcfServiceHolder()
        {
            string rootPath = HostingEnvironment.MapPath("~");

            XmlTextReader configReader = new XmlTextReader(File.OpenRead(string.Format("{0}/cfg/Configuration.xml", rootPath)));
            DirectoryInfo dir = new DirectoryInfo(string.Format("{0}/hbm", rootPath));
            NhConfigurationBuilder bld = new NhConfigurationBuilder(configReader, dir);

            bld.SetProperty("connection.connection_string", GetConnectionString(rootPath));
            bld.BuildSessionFactory();

            Sessionfactory = bld.SessionFactory;

            KnownTypes = Assembly.GetAssembly(typeof(Salesman)).GetTypes();
        }