Esempio n. 1
0
        /// <summary>

        /// initializes the session for database

        /// </summary>

        private static void Init()
        {
            NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
            config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.PostgreSQL82Dialect");
            //NHibernate.Driver.NpgsqlDriver
            //config.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.NpgsqlDriver");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, SessionFactory.connectionString);
            config.AddXmlFile(".\\AppFiles\\Database\\models.xml");

            sFactory = config.BuildSessionFactory();
        }
Esempio n. 2
0
        /// <summary>
        /// initializes the session for database
        /// </summary>
        private static void Init()
        {
            NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
            config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.PostgreSQL82Dialect");
            //NHibernate.Driver.NpgsqlDriver
            //config.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.NpgsqlDriver");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, SessionFactory.connectionString);
            config.AddXmlFile(".\\AppFiles\\Database\\models.xml");

            sFactory = config.BuildSessionFactory();
        }
Esempio n. 3
0
		/// <summary>
		/// Registers the resources.
		/// </summary>
		/// <param name="cfg">The CFG.</param>
		/// <param name="facilityConfig">The facility config.</param>
		protected void RegisterResources(Configuration cfg, IConfiguration facilityConfig)
		{
			if (facilityConfig == null) return;

			foreach (IConfiguration item in facilityConfig.Children)
			{
				String name = item.Attributes["name"];
				String assembly = item.Attributes["assembly"];

				if (assembly != null)
				{
					cfg.AddResource(name, ObtainAssembly(assembly));
				}
				else
				{
					cfg.AddXmlFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name));
				}
			}
		}
		/// <summary>
		/// Registers the resources.
		/// </summary>
		/// <param name="cfg">The CFG.</param>
		/// <param name="facilityConfig">The facility config.</param>
		protected void RegisterResources(Configuration cfg, IConfiguration facilityConfig)
		{
			if (facilityConfig == null) return;

			foreach (IConfiguration item in facilityConfig.Children)
			{
				String name = item.Attributes["name"];
				String assembly = item.Attributes["assembly"];

				if (assembly != null)
				{
					cfg.AddResource(name, this.ObtainAssembly(assembly));
				}
				else
				{
					cfg.AddXmlFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name));
				}
			}
		}