本文整理汇总了C#中Configuration.BuildSessionFactory方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.BuildSessionFactory方法的具体用法?C# Configuration.BuildSessionFactory怎么用?C# Configuration.BuildSessionFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.BuildSessionFactory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
var builder = new NHibernateSagaStorage();
var properties = SQLiteConfiguration.InMemory();
var configuration = new Configuration().AddProperties(properties);
var settings = new SettingsHolder();
settings.Set("TypesToScan", new[] { typeof(SagaWithAbstractBaseClass), typeof(ContainSagaData), typeof(MyOwnAbstractBase) });
builder.ApplyMappings(settings, configuration);
sessionFactory = configuration.BuildSessionFactory() as SessionFactoryImpl;
}
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:11,代码来源:When_automapping_sagas_with_abstract_base_class.cs
示例2: Build
public static SessionFactoryImpl Build()
{
var types = Types();
var builder = new NHibernateSagaStorage();
var properties = SQLiteConfiguration.InMemory();
var configuration = new Configuration().AddProperties(properties);
var settings = new SettingsHolder();
settings.Set("TypesToScan", types);
builder.ApplyMappings(settings, configuration);
return configuration.BuildSessionFactory() as SessionFactoryImpl;
}
示例3: SetUp
public void SetUp()
{
cfg=Fluently.Configure()
.Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<UserMap>())
.Database(MsSqlConfiguration.MsSql2008
.AdoNetBatchSize(20)
.ConnectionString(stringBuilder=>
stringBuilder.Database("test")
.TrustedConnection()
.Server("."))
.ShowSql()
.Raw("hbm2ddl.keywords", "auto-quote")
).BuildConfiguration();
factory = cfg.BuildSessionFactory();
var export = new SchemaExport(cfg);
export.Execute(true, true, false);
}
示例4: SetupContext
public void SetupContext()
{
var cfg = new Configuration()
.DataBaseIntegration(x =>
{
x.Dialect<SQLiteDialect>();
x.ConnectionString = string.Format(@"Data Source={0};Version=3;New=True;", Path.GetTempFileName());
});
var mapper = new ModelMapper();
mapper.AddMapping<Config.SubscriptionMap>();
cfg.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
new SchemaExport(cfg).Create(false, true);
subscriptionStorageSessionProvider = new SubscriptionStorageSessionProvider(cfg.BuildSessionFactory());
storage = new SubscriptionPersister(subscriptionStorageSessionProvider);
}
示例5: UseNHibernateGatewayPersisterInternal
private static Configure UseNHibernateGatewayPersisterInternal(this Configure config, Configuration configuration)
{
ConfigureNHibernate.ThrowIfRequiredPropertiesAreMissing(configuration.Properties);
GatewayPersister.NHibernate.Installer.Installer.RunInstaller = true;
ConfigureNHibernate.AddMappings<GatewayMessageMap>(configuration);
config.Configurer.ConfigureComponent<GatewayPersister.NHibernate.GatewayPersister>(
DependencyLifecycle.SingleInstance)
.ConfigureProperty(p => p.SessionFactory, configuration.BuildSessionFactory());
return config.RunGateway();
}
示例6: GenerateProxies
protected virtual GenerateProxiesResult GenerateProxies(Configuration nhibernateConfiguration, string modulePath)
{
ModuleScope moduleScope = new ModuleScope(true, ModuleScope.DEFAULT_ASSEMBLY_NAME, modulePath, ModuleScope.DEFAULT_ASSEMBLY_NAME, modulePath );
IDictionary proxies = new Hashtable();
try
{
CastleProxyFactoryFactory.ProxyFactory = new CastleProxyFactory(new DefaultProxyBuilder(moduleScope), proxies);
using (nhibernateConfiguration.BuildSessionFactory())
{
}
}
finally
{
CastleProxyFactoryFactory.ProxyFactory = null;
}
moduleScope.SaveAssembly();
moduleScope = null;
AssemblyName proxyAssemblyName = new AssemblyName(ModuleScope.DEFAULT_ASSEMBLY_NAME);
proxyAssemblyName.CodeBase = modulePath;
Assembly proxyAssembly = Assembly.Load(proxyAssemblyName);
return new GenerateProxiesResult(proxies, proxyAssembly);
}
示例7: MsSqlDaoFactory
public MsSqlDaoFactory()
{
Configuration config = new Configuration();
config.Configure();
this.sessionFactory = config.BuildSessionFactory();
}