本文整理汇总了C#中NHibernate.Cfg.Configuration.SetInterceptor方法的典型用法代码示例。如果您正苦于以下问题:C# NHibernate.Cfg.Configuration.SetInterceptor方法的具体用法?C# NHibernate.Cfg.Configuration.SetInterceptor怎么用?C# NHibernate.Cfg.Configuration.SetInterceptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Cfg.Configuration
的用法示例。
在下文中一共展示了NHibernate.Cfg.Configuration.SetInterceptor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNHibernateConfiguration
/// <summary>
/// Create an NHibernate configuration class
/// </summary>
/// <returns></returns>
public NHibernate.Cfg.Configuration CreateNHibernateConfiguration(ConfigurationFlags options,
IInterceptor interceptor)
{
var configuration = new NHibernate.Cfg.Configuration();
if ((options & ConfigurationFlags.Settings) == ConfigurationFlags.Settings)
{
configuration.SetProperty("connection.connection_string", Connection_ConnectionString);
configuration.SetProperty("connection.provider", Connection_Provider);
configuration.SetProperty("connection.driver_class", Connection_DriverClass);
configuration.SetProperty("dialect", Dialect);
configuration.SetProperty("show_sql", ShowSql.ToString(CultureInfo.InvariantCulture).ToLower());
configuration.SetProperty("proxyfactory.factory_class", ProxyFactoryClass);
//Include The TablePrefix Property For the Table Mappings ... RRRM : 23/09/2007
if (!String.IsNullOrEmpty(TablePrefix))
{
var ns = (NamingStrategy)NamingStrategy.Instance;
ns.Prefix = TablePrefix;
configuration.SetNamingStrategy(NamingStrategy.Instance);
}
}
if ((options & ConfigurationFlags.Mappings) == ConfigurationFlags.Mappings)
{
foreach (var assembly in MappingAssemblies)
configuration.AddAssembly(assembly);
}
if ((options & ConfigurationFlags.Interceptor) == ConfigurationFlags.Interceptor)
{
if (interceptor != null) configuration.SetInterceptor(interceptor);
}
if ((options & ConfigurationFlags.MappingsToExport) == ConfigurationFlags.MappingsToExport)
{
foreach (var assembly in MappingAssembliesToExport)
configuration.AddAssembly(assembly);
}
return configuration;
}
示例2: SetInterceptor
private void SetInterceptor(Configuration config)
{
config.SetInterceptor(new EnableFiltersInterceptor());
}