当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.SetProperties方法代码示例

本文整理汇总了C#中NHibernate.Cfg.Configuration.SetProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.SetProperties方法的具体用法?C# Configuration.SetProperties怎么用?C# Configuration.SetProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.SetProperties方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OneTimeInitalize

        public static void OneTimeInitalize(params Assembly[] assemblies)
        {
            if (sessionFactory != null) return;

            Dictionary<string, string> properties = new Dictionary<string, string>();

            properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");

            properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");

            properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");

            properties.Add("query.substitutions", "true=1;false=0");

            properties.Add("connection.connection_string", "Data Source=MyTestDb.db;Version=3;New=True;");

            configuration = new Configuration();

            configuration.SetProperties(properties);

            foreach (Assembly assembly in assemblies)
            {
                configuration = configuration.AddAssembly(assembly);
            }

            sessionFactory = configuration.BuildSessionFactory();
        }
开发者ID:CaduARQ,项目名称:VPRCracha,代码行数:27,代码来源:TestSessionFactorySQLLite.cs

示例2: Configure

 public static void Configure(Configuration configuration)
 {
     IDictionary<string, string> properties = new Dictionary<string, string>();
     properties[Environment.Dialect] = typeof(OracleSpatialDialect).AssemblyQualifiedName;
     properties[Environment.ConnectionProvider] = typeof(DebugConnectionProvider).AssemblyQualifiedName;
     properties[Environment.ConnectionDriver] = typeof(OracleDataClientDriver).AssemblyQualifiedName;
     properties[Environment.ConnectionString] = Settings.Default.ConnectionString;
     //properties[Environment.Hbm2ddlAuto] = "create-drop";
     configuration.SetProperties(properties);
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:10,代码来源:TestConfiguration.cs

示例3: Configure

 public static void Configure(Configuration configuration)
 {
     IDictionary<string, string> properties = new Dictionary<string, string>();
     properties[Environment.ProxyFactoryFactoryClass] = typeof(NHibernateFactory).AssemblyQualifiedName;
     properties[Environment.Dialect] = typeof(MySQL57SpatialDialect).AssemblyQualifiedName;
     properties[Environment.ConnectionProvider] = typeof(DebugConnectionProvider).AssemblyQualifiedName;
     properties[Environment.ConnectionDriver] = typeof(MySqlDataDriver).AssemblyQualifiedName;
     properties[Environment.ConnectionString] = Tests.NHibernate.Spatial.Properties.Settings.Default.ConnectionString;
     configuration.SetProperties(properties);
 }
开发者ID:rungwiroon,项目名称:NHibernate.Spatial,代码行数:10,代码来源:TestConfiguration.cs

示例4: Configure

		public static void Configure(Configuration configuration)
		{
			IDictionary<string, string> properties = new Dictionary<string, string>();
            properties[Environment.ProxyFactoryFactoryClass] = typeof(NHibernateFactory).AssemblyQualifiedName;
			properties[Environment.Dialect] = typeof(MsSql2008GeometryDialect).AssemblyQualifiedName;
			properties[Environment.ConnectionProvider] = typeof(DebugConnectionProvider).AssemblyQualifiedName;
			properties[Environment.ConnectionDriver] = typeof(SqlClientDriver).AssemblyQualifiedName;
			properties[Environment.ConnectionString] = Settings.Default.ConnectionString;
			//properties[Environment.Hbm2ddlAuto] = "create-drop";
			configuration.SetProperties(properties);
		}
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:11,代码来源:TestConfiguration.cs

示例5: SetNHibernateConfigProperties

 private void SetNHibernateConfigProperties(Configuration _cfg)
 {
     Dictionary<string, string> newProperties = new Dictionary<string, string>();
     newProperties.Add("connection.connection_string", ConfigSettings.Current.DatabaseConnectionInfo.ConnectionString);
     newProperties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
     newProperties.Add("connection.isolation", "ReadUncommitted");
     newProperties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
     newProperties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
     newProperties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu");
     _cfg.SetProperties(newProperties);
     _cfg.AddAssembly("Portlet.SimpleQuery");
 }
开发者ID:mohearn,项目名称:jics-simple-query,代码行数:12,代码来源:NHibernateFactory.cs

示例6: SetNHibernateConfigProperties

 private void SetNHibernateConfigProperties(Configuration cfg)
 {
     var newProperties = new Dictionary<string, string>
         {
             {"connection.connection_string", ConfigSettings.Current.DatabaseConnectionInfo.ConnectionString},
             {"dialect", "NHibernate.Dialect.MsSql2005Dialect"},
             {"connection.isolation", "ReadUncommitted"},
             {"connection.provider", "NHibernate.Connection.DriverConnectionProvider"},
             {"connection.driver_class", "NHibernate.Driver.SqlClientDriver"},
             {
                 "proxyfactory.factory_class",
                 "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"
             }
         };
     cfg.SetProperties(newProperties);
     cfg.AddAssembly("BCProxyLogin");
 }
开发者ID:Erls-Corporation,项目名称:BCProxyLoginPortlet,代码行数:17,代码来源:NHibernateFactory.cs

示例7: CreateNHibernateConfiguration

		protected virtual Configuration CreateNHibernateConfiguration(IEnumerable<Assembly> inputAssemblies, ProxyGeneratorOptions options)
		{
			var nhibernateConfiguration = new Configuration();

			nhibernateConfiguration.SetProperties(GetDefaultNHibernateProperties(options));

			foreach (var inputAssembly in inputAssemblies)
			{
				nhibernateConfiguration.AddAssembly(inputAssembly);
			}

			return nhibernateConfiguration;
		}
开发者ID:uQr,项目名称:NHibernate.ProxyGenerators,代码行数:13,代码来源:DefaultProxyGenerator.cs

示例8: ConfigureProperties

 public Configuration ConfigureProperties(Configuration nhibernateConfig)
 {
     return nhibernateConfig.SetProperties(_settings.GetProperties());
 }
开发者ID:rauhryan,项目名称:warmup-templates,代码行数:4,代码来源:NHibernatesessionSource.cs

示例9: BuildSessionFactory

 static Configuration BuildSessionFactory() {
     var config = new Configuration();
     config.SetProperties(CreateSessionFactoryDefaultProperties());
     config.SetProperty(NhCfgEnv.ConnectionString, "Data Source=db-dev4.gdepb.gov.cn;Initial Catalog=Test;Persist Security Info=True;User ID=udev;Password=devdev");
     var mapper = new ConventionModelMapper();
     mapper.AddMapping(new UserMapping());
     mapper.AddMapping(new RoleMapping());
     var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
     config.AddMapping(mapping);
     return config;
 }
开发者ID:beginor,项目名称:practice,代码行数:11,代码来源:UnitTest.cs

示例10: PrepareSessionFactory

        internal void PrepareSessionFactory(string ConnectionString)
        {
            IDictionary<string, string> Properties = new Dictionary<string, string>();

            Properties.Add("connection.driver_class", "NHibernate.Driver.MySqlDataDriver");
            Properties.Add("connection.connection_string", ConnectionString);
            Properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle");
            Properties.Add("dialect", "NHibernate.Dialect.MySQL5Dialect");

            NHCfg.Configuration Configuration = new NHCfg.Configuration();
            Configuration.SetProperties(Properties);

            foreach(FileInfo FI in new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "database")).GetFiles("*.dll"))
            {
                Configuration.AddAssembly(Assembly.LoadFile(FI.FullName));
            }

            fNHibernateSessionFactory = Configuration.BuildSessionFactory();
        }
开发者ID:ZakAmirz,项目名称:IHI,代码行数:19,代码来源:Core.cs

示例11: ConfigurarPersistencia

        /// <summary>
        /// Este método permite configurar el servicio de persistencia global.
        /// Qué significa esto depende de la implementación de la innerface y
        /// de el servicio subyacente utilizado para efectivamente gestionar
        /// los datos. En este caso se trata de una configuración del servicio 
        /// del NHibernate por lo que se setean los valores iniciales necesarios 
        /// para arrancar el ISessionFactory. Se deberá establecer el valor 
        /// _configurado (protected) a 'true' una vez que se haya configurado 
        /// el servicio.
        /// </summary>
        public static void ConfigurarPersistencia()
        {
            try {
                if (_configurado)
                    return;

                Configuration configuration = new Configuration();

                configuration.SetProperties(_propiedades);

                foreach (string s in _incluidos)
                    configuration.AddAssembly(s);

                if (EsquemaORM.Helper != null)
                    EsquemaORM.GenerarEsquema(configuration);

                _sessionFactory = configuration.BuildSessionFactory();

                if (EsquemaORM.Helper != null)
                    EsquemaORM.CargarEsquema();

                _configurado = true;
            } catch (Exception e) {
                throw new PersistErrorException("DB-INIT-ERROR", e.ToString());
            }
        }
开发者ID:jmfragueiro,项目名称:sgmpro,代码行数:36,代码来源:Persistencia.cs

示例12: CreateConfiguration

 /// <inheritdoc/>
 public virtual Configuration CreateConfiguration(NetworkCredential credential, Firma company)
 {
     var cfg = new Configuration();
     cfg.SetProperties(new Dictionary<string, string>
     {
         { Environment.ConnectionString, GetConnectionString(credential, company) },
         { Environment.Dialect, typeof(NHibernate.Dialect.SybaseSQLAnywhere12Dialect).AssemblyQualifiedName },
         { Environment.ConnectionDriver, typeof(NHibernate.Driver.SybaseSQLAnywhereDotNet4Driver).AssemblyQualifiedName },
     });
     foreach (var mappingAssembly in MappingAssemblies)
     {
         cfg.AddAssembly(mappingAssembly);
     }
     return cfg;
 }
开发者ID:FubarDevelopment,项目名称:Lexware,代码行数:16,代码来源:SybaseWindowsConfigurationProvider.cs


注:本文中的NHibernate.Cfg.Configuration.SetProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。