本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
示例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");
}
示例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;
}
示例8: ConfigureProperties
public Configuration ConfigureProperties(Configuration nhibernateConfig)
{
return nhibernateConfig.SetProperties(_settings.GetProperties());
}
示例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;
}
示例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();
}
示例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());
}
}
示例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;
}