本文整理汇总了C#中NHibernate.Mapping.ByCode.ConventionModelMapper.WithConventions方法的典型用法代码示例。如果您正苦于以下问题:C# ConventionModelMapper.WithConventions方法的具体用法?C# ConventionModelMapper.WithConventions怎么用?C# ConventionModelMapper.WithConventions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Mapping.ByCode.ConventionModelMapper
的用法示例。
在下文中一共展示了ConventionModelMapper.WithConventions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public static Configuration Initialize()
{
INHibernateConfigurationCache cache = new NHibernateConfigurationFileCache();
var mappingAssemblies = new[] {
typeof(ActionConfirmation<>).Assembly.GetName().Name
};
var configuration = cache.LoadConfiguration(CONFIG_CACHE_KEY, null, mappingAssemblies);
if (configuration == null) {
configuration = new Configuration();
configuration
.Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
.DataBaseIntegration(db => {
db.ConnectionStringName = "DonSharpLiteConnectionString";
db.Dialect<MsSql2008Dialect>();
})
.AddAssembly(typeof(ActionConfirmation<>).Assembly)
.CurrentSessionContext<LazySessionContext>();
var mapper = new ConventionModelMapper();
mapper.WithConventions(configuration);
cache.SaveConfiguration(CONFIG_CACHE_KEY, configuration);
}
return configuration;
}
示例2: CreateConfigurationProvider
public static IConfigurationProvider CreateConfigurationProvider()
{
var configFilePath = PathHelpers.InCurrentAppDomain(Constants.NHibernateConfigFileName);
var configuration = new Configuration();
configuration.Configure(configFilePath);
var mapper = new ConventionModelMapper();
mapper.WithConventions();
mapper.WithMappings(configuration);
return new ConfigurationProvider(configuration);
}
示例3: CanGenerateMappingDoc
public void CanGenerateMappingDoc()
{
// Need a separate config so we can get hold of the mapper after using it.
// If we use the existing config we get a duplicate mapping exception.
var config = NHibernateInitializer.CreateConfiguration();
var mapper = new ConventionModelMapper();
mapper.WithConventions(config);
var mapping = mapper.CompileMappingFor(typeof(Entity).Assembly.GetExportedTypes());
var x = mapping.AsString();
File.WriteAllText("../../NHibernateTests/Output.xml", x);
}
示例4: Initialize
public static Configuration Initialize() {
Configuration configuration = new Configuration();
configuration
.Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
.DataBaseIntegration(db => {
db.ConnectionStringName = "CaTSConnectionString";
db.Dialect<MsSql2008Dialect>();
})
.AddAssembly(typeof(ActionConfirmation<>).Assembly)
.CurrentSessionContext<LazySessionContext>();
ConventionModelMapper mapper = new ConventionModelMapper();
mapper.WithConventions(configuration);
return configuration;
}
示例5: Initialize
public static Configuration Initialize()
{
var configuration = new Configuration();
configuration
.Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
.DataBaseIntegration(db =>
{
db.ConnectionStringName = "DevelopmentStack";
db.Dialect<MsSql2008Dialect>();
db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
})
.AddAssembly(typeof (Stack).Assembly)
.CurrentSessionContext<LazySessionContext>();
ConventionModelMapper mapper = new ConventionModelMapper();
mapper.WithConventions(configuration);
return configuration;
}
示例6: Initialize
public static Configuration Initialize()
{
var cache = new NHibernateConfigurationFileCache();
var mappingAssemblies = new[] {
typeof(Entity).Assembly.GetName().Name
};
var configuration = cache.LoadConfiguration(CONFIG_CACHE_KEY, null, mappingAssemblies);
if (configuration == null) {
configuration = CreateConfiguration();
var mapper = new ConventionModelMapper();
mapper.WithConventions(configuration);
cache.SaveConfiguration(CONFIG_CACHE_KEY, configuration);
}
return configuration;
}